简体   繁体   中英

undefined local variable or method autocomplete path rails 4

I am using autocomplete gem to populate the data while entering the text. i followed autocomplete doc. In my routes i added

gem 'rails-jquery-autocomplete'

in downloads_controller

  autocomplete :downloads, :fund, :full => true

in application.js

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui
//= require autocomplete-rails

in routes file

 resources :downloads do
  get :autocomplete_downloads_fund, :on => :collection
end

in view

<%autocomplete_field_tag 'fund', '', downloads_autocomplete_path, :size => 75%>

when i run this i get ,

undefined local variable or method `downloads_autocomplete_path' for #<#

my rake routes

autocomplete_downloads_fund_downloads GET    /downloads/autocomplete_downloads_fund(.:format) downloads#autocomplete_downloads_fund
                        downloads GET       /downloads(.:format)                                downloads#index

here downloads is a table name and fund is the attribute name,

Download is the model name

can anyone help me..

Update the link:

<%= autocomplete_field_tag 'fund', '', autocomplete_downloads_fund_downloads_path, :size => 75 %>

Check all available routes:

rake routes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM