Sha256: 85c74f22728a35ed468923d6e55026a20bec766bb45fefdee06e1b3c245a24e5

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

class CreateRefMany < ActiveRecord::Migration
  def change
    create_table :users do |t|
      # implicit user_id binds to user_id of roles_users join table
      t.string :name
      t.timestamps
    end

    # join table
#    create_table :roles_users, :id => false do |t|
#      t.integer :user_id
#      t.integer :role_id
#    end

    create_table :roles do |t|
      # implicit role_id binds to role_id of roles_users join table
      t.string :name
      t.timestamps
    end    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troles-0.6.1 spec/active_record/migrations/many/ref_many.rb
troles-0.6.0 spec/active_record/migrations/many/ref_many.rb