Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Forked from jugyo/application_controller.rb
Created September 28, 2012 07:09
Show Gist options
  • Save Epictetus/3798402 to your computer and use it in GitHub Desktop.
Save Epictetus/3798402 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