Class: PermissionGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- PermissionGenerator
- Defined in:
- lib/generators/permission/permission_generator.rb
Instance Method Summary collapse
- #copy_ability ⇒ Object
- #copy_module_action_migration ⇒ Object
- #copy_module_action_model ⇒ Object
- #copy_module_group_migration ⇒ Object
- #copy_module_group_model ⇒ Object
- #copy_module_permission_migration ⇒ Object
- #copy_module_permission_model ⇒ Object
Instance Method Details
#copy_ability ⇒ Object
44 45 46 |
# File 'lib/generators/permission/permission_generator.rb', line 44 def copy_ability copy_file "ability_model.rb","app/models/ability.rb" end |
#copy_module_action_migration ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/permission/permission_generator.rb', line 16 def copy_module_action_migration if (behavior == :invoke && model_exists?("module_action")) || (behavior == :revoke && role_migration_exists?) migration_template "module_action_migration_existing.rb", "db/migrate/add_name_to_module_action.rb", migration_version: migration_version else migration_template "module_action_migration.rb", "db/migrate/create_module_action.rb", migration_version: migration_version end end |
#copy_module_action_model ⇒ Object
32 33 34 |
# File 'lib/generators/permission/permission_generator.rb', line 32 def copy_module_action_model copy_file "module_action_model.rb","app/models/module_action.rb" end |
#copy_module_group_migration ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/generators/permission/permission_generator.rb', line 8 def copy_module_group_migration if (behavior == :invoke && model_exists?("module_group")) || (behavior == :revoke && role_migration_exists?) migration_template "module_group_migration_existing.rb", "db/migrate/add_name_to_module_group.rb", migration_version: migration_version else migration_template "module_group_migration.rb", "db/migrate/create_module_group.rb", migration_version: migration_version end end |
#copy_module_group_model ⇒ Object
36 37 38 |
# File 'lib/generators/permission/permission_generator.rb', line 36 def copy_module_group_model copy_file "module_group_model.rb","app/models/module_group.rb" end |
#copy_module_permission_migration ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/generators/permission/permission_generator.rb', line 24 def if (behavior == :invoke && model_exists?("module_permission")) || (behavior == :revoke && role_migration_exists?) migration_template "module_permission_migration_existing.rb", "db/migrate/add_group_action_to_module_permission.rb", migration_version: migration_version else migration_template "module_permission_migration.rb", "db/migrate/create_module_permission.rb", migration_version: migration_version end end |
#copy_module_permission_model ⇒ Object
40 41 42 |
# File 'lib/generators/permission/permission_generator.rb', line 40 def copy_file "module_permission_model.rb","app/models/module_permission.rb" end |