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 6882079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:12:32+00:00 2026-05-27T05:12:32+00:00

I am creating my very first Rails and MVC app. It is a website

  • 0

I am creating my very first Rails and MVC app. It is a website for my wedding guests to create their RSVPs.

I have a single form that is deeply nested. An RSVP has_one User and has_many Guests.

This form creates a User, RSVP, and Guests all in one go. There is also a link to edit an existing RSVP through a login_path.

I have validates_uniqueness_of :email on the User model. I would like to redirect to the login_path if a user attempts to create a new RSVP when they’ve already created one, i.e. the :email :uniqueness validation fails.

How can I redirect to the login_path if the :email :uniqueness validation fails?

  • 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-27T05:12:33+00:00Added an answer on May 27, 2026 at 5:12 am

    You would need to test in your controller action if the unique validation failed for the that email and redirect if that’s the case. That said, I’m not sure if there is better way to know if a certain validation failed for an specific field than just comparing the error message, as follows:

    if @user.save
      # do success actions
    else
      if @user.errors[:email] == 'has already been taken' # ugh
        respond_to |format|
          format.html { redirect_to login_path(email: @user.email) }
        end
      else
        # handle other errors
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating my first site in asp.net MVC and I have a very
I am creating a very simple forum as my first MVC project. My database
I am creating a very large PHP MVC-based site that will have a large
im newbie developer and creating my first iphone app... and i have one little
I am busy creating my very first Facebook application, and although I have PHP
I have been creating a website with Ruby on Rails, and will be hosting
I'm very new to C++ and I am creating my first class. I have
I have just started creating my first website, which is backed by a database
Good morning, A bit of background might help. I'm creating a very simple app
I am very new to creating webservers - and I have had several goes

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.