active_admin 自动完成与rails3-jquery-autocomplete gem
我在使用带有 active_admin 的rails3-jquery-autocomplete gem 时遇到问题
我正在使用最新版本的 active_admin< /a> (来自 git)现在依赖于 formattastic 2,我正在使用 1.04 的 rails3-jquery-autocomplete
undefined local variable or method `autocomplete_artist_name_records_path' for #<ActiveAdmin::DSL:0x007fde797140d0>
它不喜欢我提供的 url 路由,你知道我可能做错了什么吗?
gemsrecords.rb
gem 'activeadmin', :git => 'git://github.com/gregbell/active_admin.git'
gem 'rails3-jquery-autocomplete', '~> 1.0.4'
(active_admin)
ActiveAdmin.register Record do
#...
controller do
autocomplete :artist, :name#, :full => true
end
form do |f|
f.input :artist_name, :as => :autocomplete, :url => autocomplete_artist_name_records_path
end
end
routes.rb
resources :records do
get :autocomplete_artist_name, :on => :collection
end
我也尝试了在某处找到的这个修复程序,但它没有改变任何内容,包括错误
I'm having an issue using the rails3-jquery-autocomplete gem with active_admin
I'm using the most recent version of active_admin (from git) which now relies on formtastic 2 and I'm using 1.04 of rails3-jquery-autocomplete
undefined local variable or method `autocomplete_artist_name_records_path' for #<ActiveAdmin::DSL:0x007fde797140d0>
It doesn't like the url route I'm providing, any ideas what I could be doing wrong?
gems
gem 'activeadmin', :git => 'git://github.com/gregbell/active_admin.git'
gem 'rails3-jquery-autocomplete', '~> 1.0.4'
records.rb (active_admin)
ActiveAdmin.register Record do
#...
controller do
autocomplete :artist, :name#, :full => true
end
form do |f|
f.input :artist_name, :as => :autocomplete, :url => autocomplete_artist_name_records_path
end
end
routes.rb
resources :records do
get :autocomplete_artist_name, :on => :collection
end
I also tried this fix which I found somewhere but it didn't change anything including the error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
routes.rb
中添加了admin
命名空间在
app/assets/javascript/active_admin.js
在
app/admin/records.rb
中,我的解决方法是在字符串中使用 url 而不是路径方法安装了jquery css以使自动完成建议框看起来不错。请参阅此帖子。然后编辑
app/assets/stylesheets/active_admin.css.scss
以包含 jquery-ui cssAdded
admin
namespace inroutes.rb
Added these lines in
app/assets/javascript/active_admin.js
In
app/admin/records.rb
, my workaround is using url in string instead of path methodInstalled jquery css to make the autocomplete suggestion box look nice. See this post. Then edit
app/assets/stylesheets/active_admin.css.scss
to include the jquery-ui css表单块正在 ActiveAdmins DSL 范围内执行。
尝试以部分方式呈现表单以访问 url 帮助程序。
http://activeadmin.info/docs/5-forms.html
The form block is being executed in the scope of ActiveAdmins DSL.
Try rendering the form in a partial to access url helpers.
http://activeadmin.info/docs/5-forms.html