instance method
partial_path
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
partial_path(record_or_class, controller_path = nil)
Returns plural/singular for a record or class. Example:
partial_path(post) # => "posts/post" partial_path(Person) # => "people/person" partial_path(Person, "admin/games") # => "admin/people/person"
Parameters
-
record_or_classreq -
controller_pathopt = nil
Source
# File actionpack/lib/action_controller/record_identifier.rb, line 42
def partial_path(record_or_class, controller_path = nil)
name = model_name_from_record_or_class(record_or_class)
if controller_path && controller_path.include?("/")
"#{File.dirname(controller_path)}/#{name.partial_path}"
else
name.partial_path
end
end
Defined in actionpack/lib/action_controller/record_identifier.rb line 42
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::RecordIdentifier