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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:36:10+00:00 2026-05-19T23:36:10+00:00

Recently I started using https://github.com/crowdint/rails3-jquery-autocomplete It works great, but I was trying to set

  • 0

Recently I started using https://github.com/crowdint/rails3-jquery-autocomplete

It works great, but I was trying to set a scope for the results that I was autocompleteing, in this question I got a good answer: Scoping the results for rails3 jquery autocomplete plugin

Using Claudio’s code I’ve successfully scoped as such:

class PostsController < ApplicationController
    autocomplete :post, :title

    def get_items(parameters)
        Post.where(:user_id => current_user.id)
    end

This works because I’m overwriting the plugin’s get_items method. Which you can see here: https://github.com/crowdint/rails3-jquery-autocomplete/commit/b3c18ac92ced2932ac6e9d17237343b512d2144d#L1R84 (I have a version before this commit, so get_items still works for me).

The problem with my scope, is the autocomplete functionality no longer works. When the person starts typing, the list specified in get_items just pops up, rather than items being suggested from that list.

I’m assuming I’m doing something wrong with my overwriting method. Any ideas?

Best,
Elliot

  • 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-19T23:36:10+00:00Added an answer on May 19, 2026 at 11:36 pm

    You just made me realize that overriding get_items is not as flexible as it should be.

    Your code is missing the use of parameters[:terms]

    Something like this should make it work:

    def get_items(parameters)
      Post.where(:user_id => current_user.id).where(['title LIKE ?', "#{parameters[:term]}%"]
    end
    

    This is totally unfriendly, I’ll try and work on something that makes more sense

    Or, maybe a :scope option for the autocomplete declaration makes more sense?

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

Sidebar

Related Questions

I recently started using Eclipse at work for my Java servlet projects. I've been
We recently started using maven for dependency management. Our team uses eclipse as it's
I recently started using scons to build several small cross-platform projects. One of these
I recently started using Git as my version control system for some Cocoa projects
I recently started using Linux as my primary OS. What are the tools that
I have recently started using Vim as my text editor and am currently working
I've recently started using Eclipse Ganymede CDT for C development and I couldn't like
I've recently started using code coverage tools (particularily Emma and EclEmma), and I really
I've recently started using it. However, after running it against one of my company's
My company has recently started using Scrum; we've done 2 sprints. We're still learning,

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.