Class: ActivityNotification::Generators::ControllersGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActivityNotification::Generators::ControllersGenerator
- Defined in:
- lib/generators/activity_notification/controllers_generator.rb
Overview
Controller generator to create customizable controller files from templates.
Constant Summary collapse
- CONTROLLERS =
['notifications', 'notifications_with_devise', 'subscriptions', 'subscriptions_with_devise'].freeze
Instance Method Summary collapse
-
#create_controllers ⇒ Object
Creates controller files in application directory.
-
#show_readme ⇒ Object
Shows readme to console.
Instance Method Details
#create_controllers ⇒ Object
Creates controller files in application directory
34 35 36 37 38 39 40 41 |
# File 'lib/generators/activity_notification/controllers_generator.rb', line 34 def create_controllers @target_prefix = target.blank? ? '' : (target.camelize + '::') controllers = [:controllers] || CONTROLLERS controllers.each do |name| template "#{name}_controller.rb", "app/controllers/#{target}/#{name}_controller.rb" end end |
#show_readme ⇒ Object
Shows readme to console
44 45 46 |
# File 'lib/generators/activity_notification/controllers_generator.rb', line 44 def show_readme readme "README" if behavior == :invoke end |