rails.nerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Nov-15 11:48 UTC
Why don''t Helpers auto-refresh in development mode?
Hey there I find it frustrating that my rails helps do not reload in development mode Any changes I make to a model are immediately reflected, but helper changes require a server restart Does anyone know a work around? cheers -- 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.
radhames brito
2010-Nov-15 12:00 UTC
Re: Why don''t Helpers auto-refresh in development mode?
Helper definition is loaded on application load, but the evaluation is done on every request , which are you talking about ? -- 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.
rails.nerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Nov-15 12:07 UTC
Re: Why don''t Helpers auto-refresh in development mode?
If I define "helpy" in my application_helper.rb file: def helpy return "something" end ... and then change the return value between page refreshes, it is not updated.... I just get the original method definition loaded when webrick server started On Nov 15, 11:00 pm, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Helper definition is loaded on application load, but the evaluation is done > on every request , which are you talking about ?-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
rails.nerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Nov-15 12:10 UTC
Re: Why don''t Helpers auto-refresh in development mode?
Thanks for replying, btw Is there a hack I can do to cause it to reload the definition on every request? -- 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.
Frederick Cheung
2010-Nov-15 12:19 UTC
Re: Why don''t Helpers auto-refresh in development mode?
On Nov 15, 12:07 pm, "rails.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <rails.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I define "helpy" in my application_helper.rb file: > > def helpy > return "something" > end > > ... and then change the return value between page refreshes, it is not > updated.... I just get the original method definition loaded when > webrick server started >i''ve never noticed that before. What version of rails are you running? Are you explicitly requiring any of your helper files? fred> On Nov 15, 11:00 pm, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Helper definition is loaded on application load, but the evaluation is done > > on every request , which are you talking about ?-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Nov-15 12:38 UTC
Re: Re: Why don''t Helpers auto-refresh in development mode?
Thats because the return value is part of the helper definition and the definition is set when the app is loaded, normally one would evaluate the result and this would be updated on every request, thats why your problem seems strange, but is not strange is the default behavior, so what do you do ? I have to go to work now so i cant fully explain but you have to return a lambda method if you want your result to be dynamic. I''ll show a common example with the model on rails 2 name_scope :recent ,:conditions=>{ :create_at => 2.months.ago} ^^ the 2 month ago is set on app load and not changed as long as you dont restart the app, so a year from now will have the same value name_scope :recent ,lambda {:conditions=>{ :create_at => 2.months.ago} } ^^ here the 2.month.ago is reevaluated on every call to the method -- 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.
Marnen Laibow-Koser
2010-Nov-15 14:27 UTC
Re: Why don''t Helpers auto-refresh in development mode?
Radhames Brito wrote in post #961537:> Helper definition is loaded on application load, but the evaluation is > done > on every request , which are you talking about ?Um...no. In development mode, the helper classes *should* be reloaded with every request. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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.
radhames brito
2010-Nov-15 16:49 UTC
Re: Re: Why don''t Helpers auto-refresh in development mode?
On Mon, Nov 15, 2010 at 10:27 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Radhames Brito wrote in post #961537: > > Helper definition is loaded on application load, but the evaluation is > > done > > on every request , which are you talking about ? > > Um...no. In development mode, the helper classes *should* be reloaded > with every request. > > Best, > -- >well, they dont, at least not on my apps, they get evaluated in every request, but the definition does not change. I have test it on rails 2 , but not rails 3, many times and they dont get reloaded in development. -- 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.
radhames brito
2010-Nov-15 16:56 UTC
Re: Re: Why don''t Helpers auto-refresh in development mode?
On Mon, Nov 15, 2010 at 8:38 AM, radhames brito <rbritom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thats because the return value is part of the helper definition and the > definition is set when the app is loaded, normally one would evaluate the > result and this would be updated on every request, thats why your problem > seems strange, but is not strange is the default behavior, so what do you do > ? I have to go to work now so i cant fully explain but you have to return a > lambda method if you want your result to be dynamic. > > > I''ll show a common example with the model on rails 2 > > name_scope :recent ,:conditions=>{ :create_at => 2.months.ago} > > ^^ the 2 month ago is set on app load and not changed as long as you dont > restart the app, so a year from now will have the same value > > name_scope :recent ,lambda {:conditions=>{ :create_at => 2.months.ago} } > > ^^ here the 2.month.ago is reevaluated on every call to the method >I want to clarify the highlighted part What i understand is that rails.nerd has the return value in the helper method''s definition, kind of like in this case the above is 2.month.ago example. -- 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.
Marnen Laibow-Koser
2010-Nov-15 16:58 UTC
Re: Re: Why don''t Helpers auto-refresh in development mode?
Radhames Brito wrote in post #961601:> On Mon, Nov 15, 2010 at 10:27 AM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:Please quote when replying.> >> > well, they dont, at least not on my apps, they get evaluated in every > request, but the definition does not change. I have test it on rails 2 , > but > not rails 3, many times and they dont get reloaded in development.I''ve never used Rails 3. With Rails 2 for me, helpers certainly do seem to get reloaded. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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.
rails.nerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Nov-15 21:26 UTC
Re: Why don''t Helpers auto-refresh in development mode?
I just tested this in a new, fresh Rails project and the results are different Changes to a helper are immediately reflected Turns out, "Inherited Resources" gem effects this behaviour... and locks in your helpers when the server starts -- 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.
rails.nerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Nov-16 00:23 UTC
Re: Why don''t Helpers auto-refresh in development mode?
I have created a ticket for this on the Inherited Resources page http://github.com/josevalim/inherited_resources/issues/issue/95 -- 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.