Sha256: 1959deede70a8277f14c7d16b9c770827652c7db60106fbddd91c35a3bd7bb70

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

class CreateRoleAssignments < ActiveRecord::Migration
  def self.up
    create_table :role_assignments do |t|
      t.references :role, :null => false
      t.references :assignee, :polymorphic => true, :null => false
    end
    add_index :role_assignments, [:role_id, :assignee_id, :assignee_type], :unique => true, :name => 'index_role_assignments_on_role_and_assignee'
  end

  def self.down
    drop_table :role_assignments
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
has_roles-0.3.1 generators/has_roles/templates/004_create_role_assignments.rb
has_roles-0.3.0 db/migrate/004_create_role_assignments.rb