app/controllers/application_controller.rb
# tries to authenticate password & logs user in if authenticated
tries to authenticate password & logs user in if authenticated
tries to authenticate password & logs user in if authenticated
def try_to_authenticate(user)
    authenticated = user.try(:authenticate, params[:password])
    authenticated ? log_in(user, 'Successfully Logged In!') : redirect_to_login('Invalid Password')
  end
def try_to_authenticate ( user ) authenticated = user . try ( :authenticate , params [ :password ] ) authenticated ? log_in ( user , 'Successfully Logged In!' ) : redirect_to_login ( 'Invalid Password' ) end
tries to authenticate password & logs user in if authenticated
tries to authenticate password & logs user in if authenticated
# try is an ActiveSupport method: object.try(:some_method) means if object != nil then object.some_method else nil end.
user
<not_specific>