Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 412275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:04:09+00:00 2026-05-12T18:04:09+00:00

When a user fails login on my Rails app, I’d like to point them

  • 0

When a user fails login on my Rails app, I’d like to point them to a password reset page:

flash[:notice] = "Login failed.  If you have forgotten your password, you can #{link_to('reset it', reset_path)}"

However, I can’t use link_to in a controller. What’s the best way to do this without mixing controller and view logic?

My best guess is that the flash is the wrong place to do this, but I’d appreciate any input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:04:10+00:00Added an answer on May 12, 2026 at 6:04 pm

    I think the most common solution is to stick a link to the password reset page right in your login form, so your flash message doesn’t have to deal with it at all. That also allows the user to request the reset without first failing to log in.

    If you want to do it in the flash message, you should use url_for to build the link instead of link_to.

    Alternatively, you could render a partial instead of hard-coding the message in your controller.

    flash[:error] = render_to_string(:partial => "shared/login_failed_message")
    
    # in shared/_login_failed_message.html.erb
    <%= "Login failed.  If you have forgotten your password, you can #{link_to('reset it', reset_path)}" %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login page for my Nitrogen based web app. If user authentication
i want to set the cookie before the login lik:if the user fails to
I'm working on an auth system with login failure. If the user fails to
i need a login widget thar appears on every page: when user logs in
scp foo user@remote:bar works fine scp user@remote:foo bar works fine scp user@remote:foo user@remote:bar fails
Can any one volunteer why the class below fails? ... src/model/user.rb:18: undefined method `set_schema'
User first_name: Johnny age: 15 Car name: Mazda Car name: BMW I would like
I want to create a login page, it can easy implement using Ruby on
I'm trying to set up a simple login using AuthLogic into my User table.
I'm trying to get Facebook logins working on my app using Rails, Authlogic, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.