instance method
partial_path
Ruby on Rails 6.0.6
Since v3.2.22.5 Last seen in v6.0.6 PrivateSignature
partial_path(object, view)
Obtains the path to where the object’s partial is located. If the object responds to to_partial_path, then to_partial_path will be called and will provide the path. If the object does not respond to to_partial_path, then an ArgumentError is raised.
If prefix_partial_path_with_controller_namespace is true, then this method will prefix the partial paths with a namespace.
Parameters
-
objectreq -
viewreq
Source
# File actionview/lib/action_view/renderer/partial_renderer.rb, line 487
def partial_path(object, view)
object = object.to_model if object.respond_to?(:to_model)
path = if object.respond_to?(:to_partial_path)
object.to_partial_path
else
raise ArgumentError.new("'#{object.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.")
end
if view.prefix_partial_path_with_controller_namespace
prefixed_partial_names[path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
else
path
end
end
Defined in actionview/lib/action_view/renderer/partial_renderer.rb line 487
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::PartialRenderer