Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3: undefined method `remote_form_for'

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>

Am I doing something stupid? It works perfectly with form_for.

like image 238
Steven De Coeyer Avatar asked Oct 08 '10 12:10

Steven De Coeyer


1 Answers

remote_form_for no longer exists.

Try adding

:remote => true

as an option to form_for

form_for :user, :remote => true, :url => { :controller => "users", :action => "create" } do |f|

see: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for

like image 75
Oliver Avatar answered Sep 22 '22 23:09

Oliver