crowdint / rails3-jquery-autocomplete

An easy and unobtrusive way to use jQuery's autocomplete with Rails 3

Home Page:http://rubygems.org/gems/rails3-jquery-autocomplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get scopes to work ?

NuggyBuggy opened this issue · comments

I'm trying to customize a query via named scopes.

I have:

class Principal < CrrRecord
scope :has_abc, where("name ='abc'")
end

class AutocompleterController < ApplicationController
autocomplete :principal, :name, :scopes => [:has_abc]
end

Autocomplete works, but the returned list does not seem to apply the scope, that is, I get the full set of results whether or not the condition in the scope is met or not.

I've seen other posts claiming that users could not get scopes to work, but I do not want to override get_autocomplete_items.

What am I doing wrong ?

p.s. thanks for the great gem !

Mea Culpa - I was running a much earlier version of the gem... updating to the newest gem fixes my problem....

Thanks again for the great gem.