2014-12-31 15:59:32 -05:00
|
|
|
if ExtVerifier.has_rails?
|
|
|
|
# Required to use the column support
|
|
|
|
module Rails
|
|
|
|
def self.env
|
|
|
|
{}
|
|
|
|
end
|
2014-12-29 12:22:29 -05:00
|
|
|
end
|
2014-08-07 21:56:23 -04:00
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
# Establish connection to in-memory SQLite DB
|
2016-11-08 00:07:03 -05:00
|
|
|
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
|
2014-08-07 21:56:23 -04:00
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
# Create the users table
|
|
|
|
ActiveRecord::Migration.verbose = false
|
|
|
|
ActiveRecord::Migration.create_table :users do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :rank
|
|
|
|
t.boolean :admin
|
|
|
|
t.datetime :created_at
|
|
|
|
end
|
2014-08-07 21:56:23 -04:00
|
|
|
|
2015-12-01 17:38:15 -05:00
|
|
|
ActiveRecord::Migration.create_table :emails do |t|
|
|
|
|
t.references :user
|
|
|
|
t.string :email_address
|
|
|
|
end
|
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
# Create models
|
2015-12-01 17:38:15 -05:00
|
|
|
class User < ActiveRecord::Base; has_many :emails; end
|
2014-12-31 15:59:32 -05:00
|
|
|
class SubUser < User; end
|
2015-12-01 17:38:15 -05:00
|
|
|
class Email < ActiveRecord::Base; belongs_to :user; end
|
2014-08-07 21:56:23 -04:00
|
|
|
end
|