Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Just remove the sort_locals method

  • Loading branch information...
commit 14a8fd146a64f7ed8399339fa5bc0200b54838ea 1 parent 1fbc470
@tenderlove tenderlove authored
Showing with 1 addition and 12 deletions.
  1. +1 −12 actionpack/lib/action_view/template/resolver.rb
View
13 actionpack/lib/action_view/template/resolver.rb
@@ -69,7 +69,7 @@ def build_path(name, prefix, partial)
# before returning it.
def cached(key, path_info, details, locals) #:nodoc:
name, prefix, partial = path_info
- locals = sort_locals(locals)
+ locals = locals.map { |x| x.to_s }.sort!
if key && caching?
@cached[key][name][prefix][partial][locals] ||= decorate(yield, path_info, details, locals)
@@ -98,17 +98,6 @@ def decorate(templates, path_info, details, locals) #:nodoc:
t.virtual_path ||= (cached ||= build_path(*path_info))
end
end
-
- if :symbol.respond_to?("<=>")
- def sort_locals(locals) #:nodoc:
- locals.sort
- end
- else
- def sort_locals(locals) #:nodoc:
- locals = locals.map{ |l| l.to_s }
- locals.sort!
- end
- end
end
# An abstract class that implements a Resolver with path semantics.

6 comments on commit 14a8fd1

@tilsammans

Love it.

@mat

Yeah, lovin it, too. But why this shouting?
=...!

Better perf for the inplace sort, right?

@josevalim
Owner

It looks good assuming converting symbols to string unnecessary won't affect performance.

@mat

BTW, is there any performance regression testing in place right now to catch these kind of things?

@tenderlove
Owner

@josevalim you have to do it in 1.9 anyway as the symbols aren't sortable.

@tenderlove
Owner

Oops, I mean 1.8. We can remove the convert to string in rails 4. :-)

Please sign in to comment.
Something went wrong with that request. Please try again.