Don't to_a things when we don't need to.
If the partial renderer is passed a relation or collection proxy, it will be good for us to resolve that relation or collection proxy as late as possible.
This commit is contained in:
parent
c52fa675b8
commit
5fa2c69e4b
@ -423,12 +423,12 @@ def as_variable(options)
|
||||
def collection_from_options
|
||||
if @options.key?(:collection)
|
||||
collection = @options[:collection]
|
||||
collection ? collection.to_a : []
|
||||
collection || []
|
||||
end
|
||||
end
|
||||
|
||||
def collection_from_object
|
||||
@object.to_ary if @object.respond_to?(:to_ary)
|
||||
@object if @object.respond_to?(:to_ary)
|
||||
end
|
||||
|
||||
def find_template(path, locals)
|
||||
@ -475,16 +475,12 @@ def partial_path(object, view)
|
||||
end
|
||||
|
||||
if view.prefix_partial_path_with_controller_namespace
|
||||
prefixed_partial_names[path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
|
||||
PREFIXED_PARTIAL_NAMES[@context_prefix][path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
|
||||
else
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
def prefixed_partial_names
|
||||
@prefixed_partial_names ||= PREFIXED_PARTIAL_NAMES[@context_prefix]
|
||||
end
|
||||
|
||||
def merge_prefix_into_object_path(prefix, object_path)
|
||||
if prefix.include?(?/) && object_path.include?(?/)
|
||||
prefixes = []
|
||||
|
Loading…
Reference in New Issue
Block a user