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

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

    It can depend on where your new or create action is defined. I had the same issue, turned out i had to put the @Object = object.new command inside the page method.

    For example..

    class PagesController < ApplicationController
    
    def home
        @applicant = Applicant.new
    end
    
    def about
    end
    
    def homeowner
    end
    

    end

    I before defined a "new" and "create" method and had the action in them which is usual and i do in other instances. Still don't know why.

提交回复
热议问题