Trying to Understand - resource_named_route_helper_method?

1 view
Skip to first unread message

satynos

unread,
Dec 15, 2008, 5:36:35 PM12/15/08
to resources_controller
def resource_named_route_helper_method?(resource_method, raise_error =
false)
if resource_method.to_s =~ /_(path|url)$/ &&
resource_method.to_s =~ /(^|^.*_)enclosing_resource(s)?_/
_, route_method =
*route_and_method_from_enclosing_resource_method_and_name_prefix
(resource_method, name_prefix)
elsif resource_method.to_s =~ /_(path|url)$/ &&
resource_method.to_s =~ /(^|^.*_)resource(s)?_/
_, route_method =
*route_and_method_from_resource_method_and_name_prefix
(resource_method, name_prefix)
else
return false
end
respond_to_without_named_route_helper?(route_method) ||
(raise_error && raise_resource_url_mapping_error(resource_method,
route_method))
end

What exactly does the following lines imply:
if resource_method.to_s =~ /_(path|url)$/ && resource_method.to_s =~ /
(^|^.*_)enclosing_resource(s)?_/
_, route_method =
*route_and_method_from_enclosing_resource_method_and_name_prefix
(resource_method, name_prefix)
and where are we getting the name_prefix from?

Thanks in advance.
Reply all
Reply to author
Forward
0 new messages