Hacker News new | ask | show | jobs
by stock_toaster 4553 days ago
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.