Question

I've been researching the rails-4 autocomplete gem and I've been struggling trying to understand one line given in the installation. The author states that I need to add the autocomplete as following within my routes

resources :products do
  get :autocomplete_brand_name, :on => :collection
end

but for the devise controller that i need to add it to, I don't see a clear way to add that to it.

My Routes

devise_for :users, :controllers => { :registrations => "registrations"}

any thoughts as to how I should be handling this?

Était-ce utile?

La solution

Well I figured out. I created my own controller called suggestions

Controller

class SuggestionsController < ApplicationController
  autocomplete :school, :name
end

Routes

resources :suggestions do
  get :autocomplete_school_name, :on => :collection
end

View

<div>
  <%= f.label :school %>
  <%= f.autocomplete_field :school, autocomplete_school_name_suggestions_path %>
</div>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top