More about Rails cache, the asset pipeline and javascript

I have installed a gem that assigns a javascript variable with a dynamic ruby (rails) variable, in this case it is the language locale I18n.locale.

Because the javascript files are precompiled and cached, I see that the variable is not being properly updated. So I have studied a bit how the cache works to see what is the best way to work around it.

1. Identifying the issue
Look for the cached javascript text in the files on your local development environment, I have found them in the tmp file

You can clear those with

rake tmp:clear

2. How to solve it
I have found good hints in this articles:

I need to put and exception and say “do not cache this file”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s