Sha256: 56401700b352e225a33955e26515de35607e6e9b5d20caef84bb24ee600bd666

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

# MODELS
class Product < ActiveRecord::Base
  belongs_to :company
end

class Company < ActiveRecord::Base
  has_many :products
end

# MIGRATIONS
class CreateAllTables < ActiveRecord::Migration
  def self.up
    create_table(:products) { |t| t.string :name; t.text :description; t.integer :company_id }
    create_table(:companies) { |t| t.string :name; t.text :description }
  end

  def self.down
    drop_table :products
    drop_table :companies
  end
end

ActiveRecord::Migration.verbose = false
CreateAllTables.up

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mighty_grid-0.3.2 spec/fake_app/models/active_record.rb
mighty_grid-0.3.1 spec/fake_app/models/active_record.rb
mighty_grid-0.3.0 spec/fake_app/models/active_record.rb