Sha256: 92d9245927e9810812fd61cc19760585de993da3e1744ccde2e253919068c6a6

Contents?: true

Size: 598 Bytes

Versions: 14

Compression:

Stored size: 598 Bytes

Contents

class RolifyCreate<%= table_name.camelize %> < ActiveRecord::Migration
  def change
    create_table(:<%= table_name %>) do |t|
      t.string :name
      t.references :resource, :polymorphic => true

      t.timestamps
    end

    create_table(:<%= join_table %>, :id => false) do |t|
      t.references :<%= user_reference %>
      t.references :<%= role_reference %>
    end

    add_index(:<%= table_name %>, :name)
    add_index(:<%= table_name %>, [ :name, :resource_type, :resource_id ])
    add_index(:<%= join_table %>, [ :<%= user_reference %>_id, :<%= role_reference %>_id ])
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
rolify-5.1.0 lib/generators/active_record/templates/migration.rb
rolify-5.0.0 lib/generators/active_record/templates/migration.rb
rolify-4.1.1 lib/generators/active_record/templates/migration.rb
rolify-4.1.0 lib/generators/active_record/templates/migration.rb
rolify-4.0.0 lib/generators/active_record/templates/migration.rb
rolify-3.5.2 lib/generators/active_record/templates/migration.rb
rolify-3.5.1 lib/generators/active_record/templates/migration.rb
rolify-3.5.0 lib/generators/active_record/templates/migration.rb
rolify-3.4.1 lib/generators/active_record/templates/migration.rb
rolify-3.4.0 lib/generators/active_record/templates/migration.rb
rolify-3.3.0 lib/generators/active_record/templates/migration.rb
third-prestige-rolify-3.3.0.rc5 lib/generators/active_record/templates/migration.rb
rolify-3.3.0.rc4 lib/generators/active_record/templates/migration.rb
rolify-3.3.0.rc3 lib/generators/active_record/templates/migration.rb