0
@@ -14,10 +14,10 @@ module ActionController
0
# === The Different Methods and their Usage
0
- # +GET+ Requests for a resource, no saving or editing of a resource should occur in a GET request
0
- # +POST+ Creation of resources
0
- # +PUT+ Editing of attributes on a resource
0
- # +DELETE+ Deletion of a resource
0
+ # [+GET+] Requests for a resource, no saving or editing of a resource should occur in a GET request
0
+ # [+POST+] Creation of resources
0
+ # [+PUT+] Editing of attributes on a resource
0
+ # [+DELETE+] Deletion of a resource
0
@@ -481,8 +481,7 @@ module ActionController
0
resource.collection_methods.each do |method, actions|
0
actions.each do |action|
0
action_options = action_options_for(action, resource, method)
0
- map.named_route("#{action}_#{resource.name_prefix}#{resource.plural}", "#{resource.path}#{resource.action_separator}#{action}", action_options)
0
- map.named_route("formatted_#{action}_#{resource.name_prefix}#{resource.plural}", "#{resource.path}#{resource.action_separator}#{action}.:format", action_options)
0
+ map_named_routes(map, "#{action}_#{resource.name_prefix}#{resource.plural}", "#{resource.path}#{resource.action_separator}#{action}", action_options)
0
@@ -495,18 +494,15 @@ module ActionController
0
index_route_name << "_index"
0
- map.named_route(index_route_name, resource.path, index_action_options)
0
- map.named_route("formatted_#{index_route_name}", "#{resource.path}.:format", index_action_options)
0
+ map_named_routes(map, index_route_name, resource.path, index_action_options)
0
create_action_options = action_options_for("create", resource)
0
- map.connect(resource.path, create_action_options)
0
- map.connect("#{resource.path}.:format", create_action_options)
0
+ map_unnamed_routes(map, resource.path, create_action_options)
0
def map_default_singleton_actions(map, resource)
0
create_action_options = action_options_for("create", resource)
0
- map.connect(resource.path, create_action_options)
0
- map.connect("#{resource.path}.:format", create_action_options)
0
+ map_unnamed_routes(map, resource.path, create_action_options)
0
def map_new_actions(map, resource)
0
@@ -514,11 +510,9 @@ module ActionController
0
actions.each do |action|
0
action_options = action_options_for(action, resource, method)
0
- map.named_route("new_#{resource.name_prefix}#{resource.singular}", resource.new_path, action_options)
0
- map.named_route("formatted_new_#{resource.name_prefix}#{resource.singular}", "#{resource.new_path}.:format", action_options)
0
+ map_named_routes(map, "new_#{resource.name_prefix}#{resource.singular}", resource.new_path, action_options)
0
- map.named_route("#{action}_new_#{resource.name_prefix}#{resource.singular}", "#{resource.new_path}#{resource.action_separator}#{action}", action_options)
0
- map.named_route("formatted_#{action}_new_#{resource.name_prefix}#{resource.singular}", "#{resource.new_path}#{resource.action_separator}#{action}.:format", action_options)
0
+ map_named_routes(map, "#{action}_new_#{resource.name_prefix}#{resource.singular}", "#{resource.new_path}#{resource.action_separator}#{action}", action_options)
0
@@ -532,22 +526,28 @@ module ActionController
0
action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash)
0
action_path ||= Base.resources_path_names[action] || action
0
- map.named_route("#{action}_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}#{resource.action_separator}#{action_path}", action_options)
0
- map.named_route("formatted_#{action}_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}#{resource.action_separator}#{action_path}.:format",action_options)
0
+ map_named_routes(map, "#{action}_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}#{resource.action_separator}#{action_path}", action_options)
0
show_action_options = action_options_for("show", resource)
0
- map.named_route("#{resource.name_prefix}#{resource.singular}", resource.member_path, show_action_options)
0
- map.named_route("formatted_#{resource.name_prefix}#{resource.singular}", "#{resource.member_path}.:format", show_action_options)
0
+ map_named_routes(map, "#{resource.name_prefix}#{resource.singular}", resource.member_path, show_action_options)
0
update_action_options = action_options_for("update", resource)
0
- map.connect(resource.member_path, update_action_options)
0
- map.connect("#{resource.member_path}.:format", update_action_options)
0
+ map_unnamed_routes(map, resource.member_path, update_action_options)
0
destroy_action_options = action_options_for("destroy", resource)
0
- map.connect(resource.member_path, destroy_action_options)
0
- map.connect("#{resource.member_path}.:format", destroy_action_options)
0
+ map_unnamed_routes(map, resource.member_path, destroy_action_options)
0
+ def map_unnamed_routes(map, path_without_format, options)
0
+ map.connect(path_without_format, options)
0
+ map.connect("#{path_without_format}.:format", options)
0
+ def map_named_routes(map, name, path_without_format, options)
0
+ map.named_route(name, path_without_format, options)
0
+ map.named_route("formatted_#{name}", "#{path_without_format}.:format", options)
0
def add_conditions_for(conditions, method)
0
class ActionController::Routing::RouteSet::Mapper
0
include ActionController::Resources
0
\ No newline at end of file