rails/actionpack-page_caching

multi domain issue

shoaib-iqbal opened this issue · 1 comments

how to handle if we serving to multiple domain with same code and same db based on domain name,if an action is cached it show every one same page?

vemv commented

Possible workaround: you could dynamically create one page per domain. In your controller:

DOMAINS = ['abc.com', 'def.com']

caches_page DOMAINS.map{|domain| "index_for_#{domain}" }

DOMAINS.each do |domain|
  define_method("index_for_#{domain}") do
    ...
  end
end