Class: ActiveAdmin::Generators::InstallGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- ActiveAdmin::Generators::InstallGenerator
- Defined in:
- lib/generators/active_admin/install/install_generator.rb
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #create_assets ⇒ Object
- #create_migrations ⇒ Object
- #setup_directory ⇒ Object
- #setup_routes ⇒ Object
Instance Method Details
#copy_initializer ⇒ Object
15 16 17 18 19 20 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 15 def copy_initializer @underscored_user_name = name.underscore.tr("/", "_") @use_authentication_method = [:users].present? @skip_comments = [:skip_comments] template "active_admin.rb.erb", "config/initializers/active_admin.rb" end |
#create_assets ⇒ Object
39 40 41 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 39 def create_assets generate "active_admin:assets" end |
#create_migrations ⇒ Object
43 44 45 46 47 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 43 def create_migrations unless [:skip_comments] migration_template "migrations/create_active_admin_comments.rb.erb", "db/migrate/create_active_admin_comments.rb" end end |
#setup_directory ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 22 def setup_directory empty_directory "app/admin" template "dashboard.rb", "app/admin/dashboard.rb" if [:users].present? @user_class = name template "admin_users.rb.erb", "app/admin/#{name.underscore.pluralize}.rb" end end |
#setup_routes ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 31 def setup_routes if [:users] # Ensure Active Admin routes occur after Devise routes so that Devise has higher priority inject_into_file "config/routes.rb", "\n ActiveAdmin.routes(self)", after: /devise_for .*, ActiveAdmin::Devise\.config/ else route "ActiveAdmin.routes(self)" end end |