overture
2011-Aug-15 11:25 UTC
Asset Pipeline pre-processing doesn''t clear the cache when dynamic erb is used
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? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
striknufumbalets-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2013-May-27 14:18 UTC
Re: Asset Pipeline pre-processing doesn''t clear the cache when dynamic erb is used
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. On Monday, August 15, 2011 8:25:27 AM UTC-3, overture wrote:> > 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?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/558e2ab4-5e76-4bf0-8cd9-aa04c42deab3%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Norbert Melzer
2013-May-27 16:53 UTC
Re: Re: Asset Pipeline pre-processing doesn''t clear the cache when dynamic erb is used
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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. > > > On Monday, August 15, 2011 8:25:27 AM UTC-3, overture wrote: >> >> 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? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/558e2ab4-5e76-4bf0-8cd9-aa04c42deab3%40googlegroups.com?hl=en-US > . > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BbCVsuVjhFJc0n2Rcpb9iYwnS1sW90hPsAMsqw6YDEciCkCNQ%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.