diff options
Diffstat (limited to 'railties/lib/generators/rails')
-rw-r--r-- | railties/lib/generators/rails/controller/controller_generator.rb | 6 | ||||
-rw-r--r-- | railties/lib/generators/rails/resource/resource_generator.rb | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/generators/rails/controller/controller_generator.rb b/railties/lib/generators/rails/controller/controller_generator.rb index 91470be833..5d2e36b499 100644 --- a/railties/lib/generators/rails/controller/controller_generator.rb +++ b/railties/lib/generators/rails/controller/controller_generator.rb @@ -8,6 +8,12 @@ module Rails 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 diff --git a/railties/lib/generators/rails/resource/resource_generator.rb b/railties/lib/generators/rails/resource/resource_generator.rb index 5acb839f39..02c1c39209 100644 --- a/railties/lib/generators/rails/resource/resource_generator.rb +++ b/railties/lib/generators/rails/resource/resource_generator.rb @@ -16,6 +16,7 @@ module Rails class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller" def add_resource_route + return if options[:actions].present? route "resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}" end |