class Rails::Generators::ControllerGenerator
:nodoc:
def add_routes
def add_routes return if options[:skip_routes] return if actions.empty? routing_code = actions.map { |action| "get '#{file_name}/#{action}'" }.join("\n") route routing_code, namespace: regular_class_path end
def create_controller_files
def create_controller_files template "controller.rb", File.join("app/controllers", class_path, "#{file_name}_controller.rb") end
def file_name
def file_name @_file_name ||= remove_possible_suffix(super) end
def remove_possible_suffix(name)
def remove_possible_suffix(name) name.sub(/_?controller$/i, "") end