blob: 5d2e36b4993f1a1c85730d4c8754877cb35f86fc (
plain) (
tree)
|
|
module Rails
module Generators
class ControllerGenerator < NamedBase
argument :actions, :type => :array, :default => [], :banner => "action action"
check_class_collision :suffix => "Controller"
def create_controller_files
template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
end
def add_routes
actions.reverse.each do |action|
route %{get "/#{file_name}/#{action}" => "#{file_name}##{action}"}
end
end
hook_for :template_engine, :test_framework, :helper
end
end
end
|