轨道3:未定义的方法`remote_form_for“ [英] Rails 3: undefined method `remote_form_for'
本文介绍了轨道3:未定义的方法`remote_form_for“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在共享/用户在部分相当简单的Rails远程形式HAML:
I have a fairly simple Rails remote form in HAML in a partial under shared/users:
- remote_form_for :user, :url => { :controller => "users", :action => "create" } do |f|
.field
= f.label :name, t('name')
= f.text_field :name
.field
= f.label :email, t('email')
= f.text_field :email
.actions
= f.submit
无论我多么摆弄它,这是行不通的。我送花儿给人收到以下错误:
No matter how much I fiddle with it, this just won't work. I alway get the following error:
undefined method `remote_form_for' for #<#<Class:0x1036e8e40>:0x1036dfd90>
我做一些愚蠢的事?它的工作原理完全符合的form_for。
Am I doing something stupid? It works perfectly with form_for.
推荐答案
remote_form_for不再存在。
remote_form_for no longer exists.
尝试添加
:remote => true
作为一个选项的form_for
as an option to form_for
form_for :user, :remote => true, :url => { :controller => "users", :action => "create" } do |f|
请参阅: <一href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for">http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for
这篇关于轨道3:未定义的方法`remote_form_for“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文