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