While testing the Rails 2.2.0 release I soon knew I had a problem: I’m
relying on the fact that an ERB template is recompiled if the
modification time of the file has been updated.
I work on a multisite Rails app, which uses ‘request.host’ to do a
Site.find_by_domain and uses a before filter to call
‘prepend_view_path(“#{RAILS_ROOT}/themes/#{@site.domain}/templates”).
It’s also possible to upload a new theme for a specific site via an
admin backend.
It’s comparable to Shopify, but instead of using Liquid it relies on
Rails’ templating mechanism.
Currently this means that I need to run this app in production with
‘config.cache_classes = false’ in order to upgrade to Rails 2.2.0,
which reloads all application code on every requests. That’s going to
be slow. Another solution is restarting the whole app after changing
the theme for a single site.
Is there a way for me to reset the template cache manually after a
theme has been updated?
It’s comparable to Shopify, but instead of using Liquid it relies on
‘config.cache_classes = false’ in order to upgrade to Rails 2.2.0,
which reloads all application code on every requests. That’s going to
be slow. Another solution is restarting the whole app after changing
the theme for a single site.
Is there a way for me to reset the template cache manually after a
theme has been updated?
You could just override that recompile? method
I think I could write a patch that will take the file modification
date into consideration, but I’m also eager to know, why the check has
actually been removed.
I’m trying to get themes working in my app. I’m using the
prepend_view_path in a before filter. Everything seems to work great…
however, it won’t render layouts from the theme location… it only
renders the rest of the view files from the theme location and the
layouts are from the default /app/views location…