Skip to content

Commit

Permalink
Merge pull request #5570 from avakhov/ac-caching-split
Browse files Browse the repository at this point in the history
ActionController caching small String#split optimization
  • Loading branch information
jeremy committed Mar 25, 2012
2 parents 3756a3f + 6880489 commit 64ccb59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/caching/actions.rb
Expand Up @@ -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
Expand Down

0 comments on commit 64ccb59

Please sign in to comment.