First argument in form cannot contain nil or be empty - Rails 4

前端 未结 7 1747
刺人心
刺人心 2020-12-04 19:24

I receive this error with my contact form in rails:

First argument in form cannot contain nil or be empty

View:

7条回答
  •  清歌不尽
    2020-12-04 20:04

    If in fact your instance variable is supposed to be nil, you could use :contact instead of @contact and provide a path.

    In your case, the code should be,

    <%= form_for( :contact , :html => {:class => "form-horizontal", :role => "form"}, url: login_path) do |form| %>
    

    The login_path is just an example and can be replaced as seen fit.

提交回复
热议问题