Forum: Ruby on Rails Asset Pipeline pre-processing doesn't clear the cache when dynamic erb is used

96a1d6c154708a1310dd50e266101aa3?d=identicon&s=25 overture (Guest)
on 2011-08-15 13:27
(Received via mailing list)
Pre-processing in development mode caches after the first call - which
is usually fine - however, when using an erb template with potentially
dynamic output, the cache doesn't clear.

For example, if I have a javascript file in the asset pipeline called
"time.js.erb", which outputs an alert with like so:-

     alert('<%= Time.now %>');

I only get the time for the first request and all other requests are
the cached result.  Surely the cache should be invalidated when the
dynamic erb output changes?
5f48e4cd155d905e2faf656cee4686fa?d=identicon&s=25 unknown (Guest)
on 2013-05-27 18:28
(Received via mailing list)
Hello guy, i have this problem and don't found a solution on search.
Could you tell me how make to resolve this issue?
Thank you.
1a4ff0766a653c62e0dab34bacda9873?d=identicon&s=25 Norbert Melzer (Guest)
on 2013-05-27 18:54
(Received via mailing list)
If you have this file in app/assets/javascript the file will be
evaluated
only once, in development it is when you request it the first time after
download. In production it will be the time as you precompile it.

In production also it would be contraproductive if you would compile it
everytime, as it would mean to compile everyfile again and again and
concatenize and minify them. Your user would have to download a large
file
with every request, what would be just against the meaning of the
concatenized huge javascript file.

If you really need that javascript file to be dynamically created with
every request, use it as a view.


2013/5/27 <striknufumbalets@gmail.com>
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.