我有一个相当简单的Rails远程表单在HAML中的部分共享/用户:
- 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
不管我多少钱,这都不行.我总是得到以下错误:
undefined method `remote_form_for' for #<#<Class:0x1036e8e40>:0x1036dfd90>
我做傻事吗它与form_for完美结合.
解决方法
remote_form_for不再存在.
尝试添加
:remote => true
作为form_for的选项
form_for :user,:remote => true,:action => "create" } do |f|
看到:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for