Keith Fahlgren
1/12/2007 8:37:00 PM
On 1/12/07, Pedro Fortuny Ayuso <pfortuny@gmail.com> wrote:
> 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.
Just to be explicit, it's both 'nil' or 'false' that will be reset to
the new value:
irb(main):001:0> f = false
=> false
irb(main):003:0> f ||= 1
=> 1
irb(main):004:0> f
=> 1 # was set
irb(main):002:0> n = nil
=> nil
irb(main):005:0> n ||= 1
=> 1
irb(main):006:0> n
=> 1 # was set
irb(main):007:0> t = true
=> true
irb(main):008:0> t ||= 1
=> true
irb(main):009:0> t
=> true # wasn't set
HTH,
Keith