On Mon, Nov 15, 2010 at 8:38 AM, radhames brito <rbri...@gmail.com> 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.