Will method value be cached?
For example, in situation like this:
>class Book < ActiveRecord::Base
> def best_book
> Book.find(:first, :conditions => [...])
> end
> def open_best_book
> best_book.ready
> best_book.open
> end
> def open
>...
when the open_best_book method is called, how many times the Book.find
function runs?
will rewrite the open_best_book method like below save
time?>def open_best_book
> best_book = Book.find(:first, :conditions => [...])
> best_book.ready
> best_book.open
>end
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---