diff options
author | Marcos Arias <markus@agil-e.com> | 2008-05-05 09:53:30 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-05-06 21:48:07 +1200 |
commit | 2c39836dc3c06813fce031d1bb390149b53ebd1c (patch) | |
tree | 84a6e5a1f873ed3eedebc5722890a4a7adabbf41 /actionpack/lib | |
parent | 8ded457b1b31b157d6fe89b553749579e5ac4a27 (diff) | |
download | rails-2c39836dc3c06813fce031d1bb390149b53ebd1c.tar.gz rails-2c39836dc3c06813fce031d1bb390149b53ebd1c.tar.bz2 rails-2c39836dc3c06813fce031d1bb390149b53ebd1c.zip |
Refactored and fixed Resources.map_member_actions to make use of custom ActionController::Base.resources_path_names when the option :path_names is not directly specified. Added a specific test for this functionality and fixed assert_restful_routes_for test helper to make use of ActionController::Base.resources_path_names instead of just "new" or "edit".
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#111 state:resolved]
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/resources.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb index 0f0fa27d74..c5e7dd7359 100644 --- a/actionpack/lib/action_controller/resources.rb +++ b/actionpack/lib/action_controller/resources.rb @@ -524,11 +524,9 @@ module ActionController resource.member_methods.each do |method, actions| actions.each do |action| action_options = action_options_for(action, resource, method) - action_path = action - if resource.options[:path_names] - action_path = resource.options[:path_names][action] - action_path ||= Base.resources_path_names[action] || action - end + + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= Base.resources_path_names[action] || action map.named_route("#{action}_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}#{resource.action_separator}#{action_path}", action_options) map.named_route("formatted_#{action}_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}#{resource.action_separator}#{action_path}.:format",action_options) |