提交 e4cb3819 编写于 作者: A Aaron Patterson

ask the scope for the action name

上级 374d66be
......@@ -1749,20 +1749,7 @@ def name_for_action(as, action) #:nodoc:
member_name = parent_resource.member_name
end
name = case scope_level
when :nested
[name_prefix, prefix]
when :collection
[prefix, name_prefix, collection_name]
when :new
[prefix, :new, name_prefix, member_name]
when :member
[prefix, name_prefix, member_name]
when :root
[name_prefix, collection_name, prefix]
else
[name_prefix, member_name, prefix]
end
name = @scope.action_name(name_prefix, prefix, collection_name, member_name)
if candidate = name.compact.join("_").presence
# If a name was not explicitly given, we check if it is valid
......@@ -1917,6 +1904,23 @@ def resources?
scope_level == :resources
end
def action_name(name_prefix, prefix, collection_name, member_name)
case scope_level
when :nested
[name_prefix, prefix]
when :collection
[prefix, name_prefix, collection_name]
when :new
[prefix, :new, name_prefix, member_name]
when :member
[prefix, name_prefix, member_name]
when :root
[name_prefix, collection_name, prefix]
else
[name_prefix, member_name, prefix]
end
end
def resource_scope?
RESOURCE_SCOPES.include? scope_level
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册