News for hackers. Stuff that matters.
Re:Ruby 2.1: Profiling Ruby by stock_toaster on Tuesday December 24, 2013 @09:57PM (#6962011)
Assignment has higher precedence than if, so the line originally would have evaluated as:

  (@owner ||= User.find_by_login(params[:user_id])) if params[:user_id].present?
Thus always testing the if, and then conditionally setting @owner. The new line checks the existence of @owner before evaluating the if by using parens to set precedence.

There are no comments on this comment yet.