Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure prefix in routes are generated properly.

  • Loading branch information...
commit 542878304dd53bb8bd8962c61dd9404f2ba57ec7 1 parent 20333be
@josevalim josevalim authored
Showing with 10 additions and 13 deletions.
  1. +10 −13 actionpack/lib/action_dispatch/routing/mapper.rb
View
23 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -926,11 +926,11 @@ def action_path(name, path = nil)
def prefix_name_for_action(action, as)
if as.present?
- "#{as}_"
+ as.to_s
elsif as
- ""
+ nil
elsif !canonical_action?(action, @scope[:scope_level])
- "#{action}_"
+ action.to_s
end
end
@@ -941,22 +941,19 @@ def name_for_action(action, as=nil)
if parent_resource
collection_name = parent_resource.collection_name
member_name = parent_resource.member_name
- name_prefix = "#{name_prefix}_" if name_prefix.present?
end
- case @scope[:scope_level]
+ name = case @scope[:scope_level]
when :collection
- "#{prefix}#{name_prefix}#{collection_name}"
+ [name_prefix, collection_name]
when :new
- "#{prefix}new_#{name_prefix}#{member_name}"
+ [:new, name_prefix, member_name]
else
- if shallow_scoping?
- shallow_prefix = "#{@scope[:shallow_prefix]}_" if @scope[:shallow_prefix].present?
- "#{prefix}#{shallow_prefix}#{member_name}"
- else
- "#{prefix}#{name_prefix}#{member_name}"
- end
+ [shallow_scoping? ? @scope[:shallow_prefix] : name_prefix, member_name]
end
+
+ name.unshift(prefix)
+ name.select(&:present?).join("_")
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.