test/test_helper.rb in better_ar-0.2.1 vs test/test_helper.rb in better_ar-0.2.2
- old
+ new
@@ -15,16 +15,18 @@
)
users_table = %{CREATE TABLE users (id INTEGER PRIMARY KEY, age INTEGER, name TEXT, object_type TEXT, object_id INTEGER);}
records_table = %{CREATE TABLE records (id INTEGER PRIMARY KEY, user_id INTEGER, name TEXT);}
reports_table = %{CREATE TABLE reports (id INTEGER PRIMARY KEY, record_id INTEGER, name TEXT);}
+profiles_table = %{CREATE TABLE profiles (id INTEGER PRIMARY KEY, user_id INTEGER, title TEXT);}
ActiveRecord::Base.connection.execute(users_table)
ActiveRecord::Base.connection.execute(records_table)
ActiveRecord::Base.connection.execute(reports_table)
class User < ActiveRecord::Base
has_many :records
+ has_one :profile
belongs_to :object, :polymorphic => true
end
class Record < ActiveRecord::Base
belongs_to :user
@@ -33,5 +35,8 @@
class Report < ActiveRecord::Base
belongs_to :record
end
+class Profile < ActiveRecord::Base
+ belongs_to :user
+end