Sha256: 18f4fbc0592eeb309c7e6533a5123b4eb3b156c6d4e96ede9b2463ed14bb3485

Contents?: true

Size: 806 Bytes

Versions: 10

Compression:

Stored size: 806 Bytes

Contents

ActiveRecord::Base.establish_connection(
  :adapter  => 'sqlite3',
  :database => File.join(File.dirname(__FILE__), 'test.db')
)

class CreateSchema < ActiveRecord::Migration
  def self.up
    create_table :users, :force => true do |t|
      t.string  :first_name
      t.string  :last_name
      t.string  :email
      t.boolean :admin, :default => false
    end

    create_table :posts, :force => true do |t|
      t.string  :name  
      t.integer :author_id
    end
  end
end

CreateSchema.suppress_messages { CreateSchema.migrate(:up) }

class User < ActiveRecord::Base
  validates_presence_of :first_name, :last_name, :email
  has_many :posts, :foreign_key => 'author_id'
end

class Post < ActiveRecord::Base
  validates_presence_of :name, :author_id
  belongs_to :author, :class_name => 'User'
end

Version data entries

10 entries across 10 versions & 6 rubygems

Version Path
jonysk-factory_girl-1.1.2 test/models.rb
jrun-factory_girl-1.1.3.9999 test/models.rb
multiplay-factory_girl-1.1.5 test/models.rb
thoughtbot-factory_girl-1.1.1 test/models.rb
thoughtbot-factory_girl-1.1.2 test/models.rb
thoughtbot-factory_girl-1.1.3 test/models.rb
threedaymonk-factory_girl-1.1.4 test/models.rb
factory_girl-1.1.1 test/models.rb
factory_girl-1.1.2 test/models.rb
factory_girl-1.1.3 test/models.rb