class Phlex::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 copy_view_files
def copy_view_files base_path = File.join("app/views", class_path, file_name) empty_directory base_path actions.each do |action| Rails::Generators.invoke("phlex:view", [remove_possible_suffix(name) + "/" + action]) end end
def create_controller_files
def create_controller_files template "controller.rb.erb", 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 parent_class_name
def parent_class_name options[:parent] end
def remove_possible_suffix(name)
def remove_possible_suffix(name) name.sub(/_?controller$/i, "") end