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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:29:52+00:00 2026-05-20T11:29:52+00:00

So I found some great info on Autocomplete for Rails 3, it looks really

  • 0

So I found some great info on Autocomplete for Rails 3, it looks really easy to use. But I have a use case that doesnt fit and I need some advice.

I want to give the user the ability to add Products and Services to an Invoice through a simple form. I’d like them to be able to type into the Item field and have it autocomplete from both Product.name and Service.name as a single set.

I’m thinking of trying to write a parent model that overlays all three, but I still don’t think that solves my problem since I can’t use a function in the autocomplete definition from what I understand.

Any advice on how I might try to accomplish this? Even with the simple search examples that are out there they seem to be restricted to a single model.

  • 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-20T11:29:53+00:00Added an answer on May 20, 2026 at 11:29 am

    If you’re not opposed to introducing Redis into the mix, have a look at https://github.com/seatgeek/soulmate — From the README:

    Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis’s sorted sets to build an index of partially completed words and the corresponding top matching items, and provides a simple sinatra app to query them. Soulmate finishes your sentences.

    Soulmate was designed to be simple and fast, and offers the following:

    • Provide suggestions for multiple types of items in a single query (at SeatGeek we’re autocompleting for performers, events, and venues)
    • Results are ordered by a user-specified score
    • Arbitrary metadata for each item (at SeatGeek we’re storing both a url and a subtitle)

    An item is a simple JSON object that looks like:

    {
      "id": 3,
      "term": "Citi Field",
      "score": 81,
      "data": {
        "url": "/citi-field-tickets/",
        "subtitle": "Flushing, NY"
      }
    }
    

    Where id is a unique identifier (within the specific type), term is the phrase you wish to provide completions for, score is a user-specified ranking metric (redis will order things lexicographically for items with the same score), and data is an optional container for metadata you’d like to return when this item is matched (at SeatGeek we’re including a url for the item as well as a subtitle for when we present it in an autocomplete dropdown).

    See Soulmate in action at SeatGeek.

    If nothing else, maybe it’ll give you some ideas on how to structure the data in a way that makes sense.

    I did not write or have anything to do with soulmate. It’s just a library I discovered when trying to solve a similar problem. Hope it helps!

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

Sidebar

Related Questions

I have done some research prior to and have found some great articles but
I found some mapkit code on the internet that looks like this: - (void)recenterMap
I found some great help on this site that helped me tile an image
I have found some great articles ( Maoni , Richter #1 , Richter #2
I found some great sql code for dynamic sort & order but I am
I have found some great ways to check for where the scroll bar is
I have some great troubles overriding some functions in an external App that I
I have a code that works great on iPhone, but when it comes to
My original question can be found here , for which I've gotten some great
Some days ago I found a great project: vs-android. It allows you to build

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.