I am looking for the best way to set the cache directory based on the subdomain. Example : if the subdomain host is fr.mydomain.com, i want to cache the file in ROOT/cache/fr and if it is en.mydomain.com, i want to cache the file in ROOT/cache/en The problem is that the cache directory is set in the config part of rails and i dont know how to change it in realtime. Any good advice ? ps: In my nginx config, of course, i would rewrite the uri based on this subdomain. This part is already working. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Joshua Abbott
2008-Jun-03 16:23 UTC
Re: Dynamic page caching directory based on subdomain name
Here''s something I just posted on my blog yesterday about storing a cached file. This applies to both action and page caching. I assume you could specify the path at runtime based off the subdomain you''re using. Also, take a look at the documentation in action_controller/caching/pages.rb file: http://github.com/rails/rails/tree/master/actionpack/lib/action_controller/caching/pages.rb. -- Josh Jm Goem wrote:> I am looking for the best way to set the cache directory based on the > subdomain. > > Example : > if the subdomain host is fr.mydomain.com, i want to cache the file in > ROOT/cache/fr and if it is en.mydomain.com, i want to cache the file in > ROOT/cache/en > > The problem is that the cache directory is set in the config part of > rails and i dont know how to change it in realtime. > > Any good advice ? > > ps: > In my nginx config, of course, i would rewrite the uri based on this > subdomain. This part is already working.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you for this info. I guess you meant this post http://thereverend.tumblr.com/post/36941827/rails-2-1-action-caching Great blog by the way :-) I read the comments in the code of ror and understand better how it works. Actually it is quite simple and i will probably rewrite the right method. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
OK so i rewrite cache_page with something like : class ApplicationController < ActionController::Base ... class << self def cache_page content, path super content, @lang + path end end end where @lang is set in a before_filter of my controller. But it does not work ! @lang is nil so i get an error like "The error occurred while evaluating nil.+):" I am missing something? How do i access @lang ? Thank you in advance -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---