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

  • Home
  • SEARCH
  • 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 963597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:41:46+00:00 2026-05-16T01:41:46+00:00

I have use rails3-jquery-autocomplete plugin and I am just wondering how can I use

  • 0

I have use rails3-jquery-autocomplete plugin and I am just wondering how can I use it to do multiple words autocomplete.

e.g. INPUT rails, gem
it should generate auto-list twice.

How to solve this problem?..

  • 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-16T01:41:46+00:00Added an answer on May 16, 2026 at 1:41 am

    rails3-jquery-autocomplete plugin? It seems that it doesn’t support multiple autocomplete, you need to modify the plugin code!!
    If you insist on your former ideas, follow my steps.

    1. run bundle show rails3-jquery-autocomplete to get the plugin working directroy
    2. mate /lib/autocomplete.rb
    3. modify the define_method like this:

      define_method("autocomplete_#{object}_#{method}") do
        arr = params[:term].split(",")
        unless params[:term] && params[:term].empty?
          items = object.to_s.camelize.constantize.where(["LOWER(#{method}) LIKE ?", "#{arr[arr.size-1]}%"]).limit(limit).order(order)
        else
          items = {}
      end
      
      render :json => json_for_autocomplete(items, method)
      

      end

    4. modify autocomplete-rails.js like this

      function split(val) {
      return val.split(/,\s*/);
      }
      function extractLast(term) {
      return split(term).pop();
      }
      $(document).ready(function(){
      $('input[autocomplete]').each(function(i){
      $(this).autocomplete({
      source: $(this).attr('autocomplete'),
      focus: function() {
      return false;
      },
      select: function(event, ui) {
      var terms = split( this.value );
      // remove the current input
      terms.pop();
      // add the selected item
      terms.push( ui.item.value );
      // add placeholder to get the comma-and-space at the end
      terms.push("");
      this.value = terms.join(",");
      return false;
      }
      });
      });
      });

    5. restart your server and try

    !! remember you’d better backup autocomplete.rb to avoid overwrite after you run bundle install.

    Good luck!

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

Sidebar

Related Questions

I'm trying to use rails3-jquery-autocomplete gem on OSX 10.7, Rails 3.1.0, Ruby 1.9.2-p290 I
In Rails 2.x you can use validations to make sure you have a unique
Using: jquery3-autocomplete gem at 1.0.5 jquery-rails gem at 1.0.19 mysql2 gem at 0.2.7 The
I am using jquery-rails-autocomplete and want to have autocomplete on more than one column.
I'm running a Rails 3 app, where I have a jQuery autocomplete box, which
I have just started considering using the HTML 5 api for a Rails/JQuery project,
Does Ruby on Rails have a way to use jQuery rather than Prototype under-the-bonnet
I want to use this jquery plugin in my rails3 apps http://gmap.nurtext.de/ (Google Maps
We have a very simple use of datepicker in rails 3.1.3 app with jquery.
I have a non-rails application that I want to use rails active-record migrations with.

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.