Class: Symphonia::Generators::EntityController

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/symphonia/entity_controller/entity_controller_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_controller_filesObject



21
22
23
24
# File 'lib/generators/symphonia/entity_controller/entity_controller_generator.rb', line 21

def create_controller_files
  template_file = options.api? ? "api_controller.rb" : "controller.rb"
  template template_file, File.join("app/controllers", controller_class_path, "#{controller_file_name}_controller.rb")
end

#edit_helperObject

:doc:



38
39
40
# File 'lib/generators/symphonia/entity_controller/entity_controller_generator.rb', line 38

def edit_helper # :doc:
  "edit_#{show_helper}"
end

#namespaceObject



30
31
32
# File 'lib/generators/symphonia/entity_controller/entity_controller_generator.rb', line 30

def namespace
  options['namespace'] && options['namespace'].safe_constantize || super
end

#new_helperObject

:doc:



42
43
44
# File 'lib/generators/symphonia/entity_controller/entity_controller_generator.rb', line 42

def new_helper # :doc:
  "new_#{singular_table_name}_path"
end

#show_helperObject

:doc:



34
35
36
# File 'lib/generators/symphonia/entity_controller/entity_controller_generator.rb', line 34

def show_helper # :doc:
  "#{singular_table_name}_path(@#{singular_table_name})"
end