test/helper.rb in better_ar-0.0.4 vs test/helper.rb in better_ar-0.0.5
- old
+ new
@@ -15,9 +15,17 @@
:adapter => defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3',
:database => ':memory:'
)
users_table = %{CREATE TABLE users (id INTEGER PRIMARY KEY, age INTEGER, name TEXT);}
+records_table = %{CREATE TABLE records (id INTEGER PRIMARY KEY, user_id INTEGER, name TEXT);}
ActiveRecord::Base.connection.execute(users_table)
+ActiveRecord::Base.connection.execute(records_table)
-class User < ActiveRecord::Base; end
+class User < ActiveRecord::Base
+ has_many :records
+end
+
+class Record < ActiveRecord::Base
+ belongs_to :user
+end