From: Pedro Fortuny Ayuso Date: 2007-01-13T04:58:15+09:00 Subject: Re: What does this mean? ||= ------=_Part_81103_5770294.1168631891324 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline It does the following in this order: if @account HAS A VALUE (is not nil) then DO NOTHING otherwise, compute Account.find(...) and set its return value into @account. It is useful whenever you want to avoid computing something if it already holds a value. Pedro. On 1/12/07, Justin Ko wrote: > > I'm looking at this method and don't understand what ||= means: > > def current_account > @account ||= Account.find(session[:account_id]) > end > > I have the ruby for rails book and can't find anything on it. > > -- > Posted via http://www.ruby-forum.com/. > > -- Pedro Fortuny Ayuso C/Capuchinos 14, 1. 47006 Valladolid. SPAIN http://pfortuny.sdf-eu.org ------=_Part_81103_5770294.1168631891324--