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 use collection outside resource(s) scope + autocomplete

Akram-Khan opened this issue · comments

I am trying to use autocomplete via autocomplete at the time of user registrations using devise.

I get this error when defining the routes.

Here is my code :-

Registration Controller :-

class RegistrationsController < Devise::RegistrationsController
autocomplete :location, :name
end
Routes :-

devise_for :users, :controllers => {:registrations => "registrations"} do
get :autocomplete_location_name, :on => :collection
end
Form :-

=f.autocomplete_field :location_name, autocomplete_location_name_path
I want user to enter their location at the time of registration. I have got location model and want to autocomplete the fields based on the location data which I have got.

@Akram-Khan I guess the issue is with your routing, the collection should come within a resource.

    resource :users do
      get :autocomplete_location_name, :on => :collection
    end

@Akram-Khan , has this issue been resolved?

Closing since this issue is several months old and we haven't heard back if the solution proposed by @manusajith solved this issue. @Akram-Khan you can re-open if you are still having issues.