Permalink
Browse files

Just remove the sort_locals method

  • Loading branch information...
1 parent 1fbc470 commit 14a8fd146a64f7ed8399339fa5bc0200b54838ea @tenderlove tenderlove committed Aug 9, 2011
Showing with 1 addition and 12 deletions.
  1. +1 −12 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

Contributor

tilsammans replied Aug 10, 2011

Love it.

mat replied Aug 10, 2011

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

Better perf for the inplace sort, right?

Contributor

josevalim replied Aug 10, 2011

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

mat replied Aug 10, 2011

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

Owner

tenderlove replied Aug 10, 2011

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

Owner

tenderlove replied Aug 10, 2011

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

Please sign in to comment.