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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:17:37+00:00 2026-05-13T10:17:37+00:00

This is pretty simple, I just can’t quite get it. I’m sure there’s a

  • 0

This is pretty simple, I just can’t quite get it. I’m sure there’s a rails-way to do it.

When creating a new comment, I want the user to be able to enter her name in a field, but have the form submit the matching ID for her name (or toss an error/create new person).

Thanks!

  • 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-13T10:17:38+00:00Added an answer on May 13, 2026 at 10:17 am

    There are a couple of ways to go about this:

    1. In your controller, split the name on ” ” and save each to a variable, then do a User.find_by_firstname_and_lastname(firstname, lastname). If none exists, tell the user to create one.
    2. Have the text field that the users enters their name into be an AJAXified field that searches for their username and lets them select the correct one. If none exists, you can then find out immediately and tell them that they need to create an account. If it finds one, it sets the value of a hidden field to the ID of the user that was selected.

    Option 1 is very error prone, but option 2 requires quite a bit more work. Honestly, this is going to be a hard one to pull off properly. What do you do if there are two John Smiths? How do they know which one to choose, how do you choose in the backend, etc.

    I would highly suggest making it based off of username instead of first name or last name. However, if you show the user which one you are going to use (possibly by showing their username, email, etc) then it could work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New Rails programmer here. There is probably a pretty simple solution to this, but
Im sure this is pretty simple but I just cant seem to find the
I'm new to jquery and ajax - just can't seem to get this to
This should be pretty simple, but I am new at LINQ. I have a
This is probably pretty simple, but I can't figure out how to do it:
This is pretty much just a simple join statemnet I believe. I've not worked
This is probably pretty simple, but I can't find the answer in the docs.
My problem is pretty simple, but I just can't solve it by myself. Does
I imagine this is pretty dead-simple, but somehow I haven’t been able to get
This seems pretty simple, but I can't seem to figure it out. I want

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.