Sha256: f055584efb3ec9c9a327d9ad93da64a1d111bf88d970454eb6449a37453afc9d

Contents?: true

Size: 873 Bytes

Versions: 4

Compression:

Stored size: 873 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 :publications, :force => true do |t|
      t.string :name
    end
    
    create_table :articles, :force => true do |t|
      t.references :publication
      t.string  :title
      t.integer :rating
      t.string :author
    end

    create_table :comments, :force => true do |t|
      t.references :article
      t.string  :data
    end
  end
end

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

class Publication < ActiveRecord::Base
  has_many :articles
end

class Article < ActiveRecord::Base
  has_many :comments
  belongs_to :publication
end

class Comment < ActiveRecord::Base
  belongs_to :article
end

class NonModel
  attr_accessor :name
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aub-machine-1.0.0 test/models.rb
aub-machine-1.0.1 test/models.rb
aub-machine-1.0.2 test/models.rb
aub-machine-1.0.3 test/models.rb