lib/express_templates/components/capabilities/resourceful.rb in express_templates-0.9.5 vs lib/express_templates/components/capabilities/resourceful.rb in express_templates-0.9.6
- old
+ new
@@ -130,11 +130,15 @@
config[:collection_path].call()
else
config[:collection_path]
end
else
- helpers.instance_eval collection_path_helper
+ if helpers.respond_to?(:collection_path)
+ helpers.collection_path
+ else
+ helpers.instance_eval collection_path_helper
+ end
end
end
def collection_path_helper
if path_namespace
@@ -176,14 +180,18 @@
config[:resource_path].call(ivar_or_resource)
else
config[:resource_path]
end
else
- if ivar_or_resource.respond_to?(:to_param) &&
- ![true, false].include?(ivar_or_resource)
- helpers.instance_eval("#{resource_path_helper}('#{ivar_or_resource.to_param}')")
+ if helpers.respond_to?(:resource_path)
+ helpers.resource_path
else
- helpers.instance_eval("#{resource_path_helper}(#{ivar_or_resource ? '@' : ''}#{resource_name})")
+ if ivar_or_resource.respond_to?(:to_param) &&
+ ![true, false].include?(ivar_or_resource)
+ helpers.instance_eval("#{resource_path_helper}('#{ivar_or_resource.to_param}')")
+ else
+ helpers.instance_eval("#{resource_path_helper}(#{ivar_or_resource ? '@' : ''}#{resource_name})")
+ end
end
end
end
def resource_name_with_path_prefix