Permalink
Browse files

Merge pull request #5570 from avakhov/ac-caching-split

ActionController caching small String#split optimization
  • Loading branch information...
2 parents 3756a3f + 6880489 commit 64ccb59c9aba9e9f7186e2332927a911763869bf @jeremy jeremy committed Mar 25, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_controller/caching/actions.rb
@@ -170,14 +170,14 @@ def initialize(controller, options = {}, infer_extension = true)
options.reverse_merge!(:format => @extension) if options.is_a?(Hash)
end
- path = controller.url_for(options).split(%r{://}).last
+ path = controller.url_for(options).split('://', 2).last
@path = normalize!(path)
end
private
def normalize!(path)
path << 'index' if path[-1] == ?/
- path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}")
+ path << ".#{extension}" if extension and !path.split('?', 2).first.ends_with?(".#{extension}")
URI.parser.unescape(path)
end
end

0 comments on commit 64ccb59

Please sign in to comment.