Sha256: ab1368bb0dae4d9fbc072c931e6bba47e7c8b3d27f524e828a70c90c4de5eac3
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
# Inspired/borrowed from @ernie's way of building out a database in # ransack and squeel ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ':memory:' ) class User < ActiveRecord::Base has_guises :Technician, :Supervisor, :association => :user_roles, :attribute => :name, :foreign_key => :person_id end class UserRole < ActiveRecord::Base guise_for :user, :foreign_key => :person_id end module Database def self.create ActiveRecord::Base.silence do ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users, :force => true do |t| t.string :name t.string :email end create_table :user_roles, :force => true do |t| t.string :name t.integer :person_id end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guise-0.2.3 | spec/support/database.rb |
guise-0.2.0 | spec/support/database.rb |