Class: RoleableCreateRolesAndAppliedRoles
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- RoleableCreateRolesAndAppliedRoles
- Defined in:
- lib/generators/roleable/install/templates/migration.rb
Instance Method Summary collapse
Instance Method Details
#change ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/roleable/install/templates/migration.rb', line 3 def change create_table :roles do |t| t.string :name t. end create_table :applied_roles do |t| t.references :subject t.references :role t.references :resource, :polymorphic => true t. end add_index :applied_roles, :subject_id add_index :applied_roles, [:resource_type, :resource_id] end |