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

前端 未结 7 1758
刺人心
刺人心 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:13

    I know this has an accepted answer, but that didn't solved my same issue(i didn't wanted to use new in my view) and i intend to post what solved mine.

    This is always a typo, you can check your routes with $rake routes if routes are ok, than its some kind of type somewhere else.

    In my case i was using sublime editor, and i had an extra def above the def new in my controller, i don't know how it got there, but it was there...Removing it solved my issue after about half hour of nail bitting... There can be any kind of typo causing this issue. This error just means that the new method is not being accessed, if it was being accessed it would have initialized the variable.

    I repeat, always a typo somewhere.

    Hope this helps anyone.

提交回复
热议问题