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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:13:29+00:00 2026-05-27T08:13:29+00:00

I want to do a find in Rails basically to check if an object

  • 0

I want to do a find in Rails basically to check if an object already exists in the database.
I have a CSV, which I have little control over the format of it.
I have a field in the CSV called ‘name’ which is the example I have contains 5 words. This field contains a name and address, but it is not confined to any format.

In my database I have fields such as ‘name’, ‘address 1’, ‘address 2’.
Basically I want to see if any part of the name field in the CSV matches up to any of the fields in my database.

I know I have to do a SQL like command probably but am not sure how to go about it.

  • 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-27T08:13:30+00:00Added an answer on May 27, 2026 at 8:13 am

    You can do it using LIKE :

    User.where('name LIKE ?', "%#{@user.name}%")
    

    The syntax for a LIKE sql statement to find a field for a given string fragment is to surround your string fragment with % characters, so the resulting SQL will look something like this

    "SELECT \"users\".* FROM \"users\" WHERE (name LIKE '%Rob Phillips%')"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database named bbs, which have 37 tables. I want to find
I want to find a way to develop database projects quickly in Visual Studio.
Suppose you want to find the last record entered into the database (highest ID)
I have a Rails app with Users, and each user HABTM Roles. I want
ruby 1.9.2p290 rails 3.1.1 Basically I have two models: CHEFS and RECIPES. class Chef
How do I get either true or false on a database find in Rails?
I want to find how much time a PHP http request spends in Database.
In my Rails application I have an action which creates a XML document using
I have done simple Rails finds for two tables, but now find that with
I have a Rails application that I want to be able to jump to

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.