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