Class: GlobalRoles::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- GlobalRoles::Generators::InstallGenerator
- Defined in:
- lib/generators/global_roles/install_generator.rb
Constant Summary collapse
- DEFAULT_ROLES =
%w(regular admin moderator)
Instance Method Summary collapse
Instance Method Details
#inject_user_class ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/global_roles/install_generator.rb', line 17 def inject_user_class inject_into_file(model_path, :after => inject_global_roles_method) do <<RUBY # Global roles ROLES = #{roles_list} setup_global_roles!#{default_role} RUBY end end |
#setup_migration ⇒ Object
29 30 31 |
# File 'lib/generators/global_roles/install_generator.rb', line 29 def setup_migration invoke "active_record:install", [ name, fetch_default ] end |