changed if user.presnt? (which) is a rails method (actionsupport) and used unless user.nil?