Created
          September 27, 2012 10:29 
        
      - 
      
- 
        Save jugyo/3793352 to your computer and use it in GitHub Desktop. 
    switching page_cache_path for pc and mobile
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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