Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created September 27, 2012 10:29
Show Gist options
  • Save jugyo/3793352 to your computer and use it in GitHub Desktop.
Save jugyo/3793352 to your computer and use it in GitHub Desktop.
switching page_cache_path for pc and mobile
class ApplicationController < ActionController::Base
include Mobylette::RespondToMobileRequests
...
protected
def cache_page_with_mobile_feature(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)
prefix = params[:format] == 'mobile' ? '/mobile' : '/pc'
path = "#{prefix}#{request.path}"
cache_page_without_mobile_feature(content, path, gzip)
end
alias_method_chain :cache_page, :mobile_feature
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment