Ruby returns the value of the last line executed.

Don't do this:

def foo
  value = Foo.first(:conditions => { :label => "bar" })
  return value
end

Do this instead:

def foo
  Foo.first(:conditions => { :label => "bar" })
end
written by
Craig
published
2009-10-21
Disagree? Found a typo? Got a question? Email me at craig@barkingiguana.com.