2007-09-20 23:22:30 +00:00
|
|
|
class Contact < ActiveRecord::Base
|
2011-02-04 21:34:41 +00:00
|
|
|
establish_connection(:adapter => 'fake')
|
|
|
|
|
|
|
|
connection.tables = ['contacts']
|
|
|
|
connection.primary_keys = {
|
|
|
|
'contacts' => 'id'
|
|
|
|
}
|
2011-02-01 19:30:09 +00:00
|
|
|
|
2007-09-20 23:22:30 +00:00
|
|
|
# mock out self.columns so no pesky db is needed for these tests
|
|
|
|
def self.column(name, sql_type = nil, options = {})
|
2011-02-04 21:34:41 +00:00
|
|
|
connection.merge_column('contacts', name, sql_type, options)
|
2007-09-20 23:22:30 +00:00
|
|
|
end
|
|
|
|
|
2011-09-10 20:10:01 +00:00
|
|
|
column :name, :string
|
|
|
|
column :age, :integer
|
|
|
|
column :avatar, :binary
|
|
|
|
column :created_at, :datetime
|
|
|
|
column :awesome, :boolean
|
|
|
|
column :preferences, :string
|
|
|
|
column :alternative_id, :integer
|
2008-01-18 07:27:03 +00:00
|
|
|
|
2007-09-20 23:22:30 +00:00
|
|
|
serialize :preferences
|
2010-04-30 00:39:52 +00:00
|
|
|
|
|
|
|
belongs_to :alternative, :class_name => 'Contact'
|
|
|
|
end
|