Class: Effective::Generators::ControllerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Helpers
Defined in:
lib/generators/effective/controller_generator.rb

Instance Method Summary collapse

Instance Method Details

#assign_actions ⇒ Object



20
21
22
# File 'lib/generators/effective/controller_generator.rb', line 20

def assign_actions
  @actions = invoked_actions
end

#assign_attributes ⇒ Object



24
25
26
27
# File 'lib/generators/effective/controller_generator.rb', line 24

def assign_attributes
  @attributes = invoked_attributes.presence || resource.belong_tos_attributes.merge(resource_attributes)
  self.class.send(:attr_reader, :attributes)
end

#create_controller ⇒ Object



33
34
35
# File 'lib/generators/effective/controller_generator.rb', line 33

def create_controller
  template 'controllers/controller.rb', resource.controller_file
end

#invoke_controller ⇒ Object



29
30
31
# File 'lib/generators/effective/controller_generator.rb', line 29

def invoke_controller
  say_status :invoke, :controller, :white
end