Rails,缺少参数

Rails, param is missing

当我尝试保存时,出现错误。

param is missing or the value is empty: help

我哪里错了?我第一次看到这个错误

我的application_controller.rb

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  def authenticate_admin_user!
    authenticate_user!
    redirect_to root_path unless current_user.admin?
  end

  def help_request
    @help = Help.new(help_params)
    if @help.save
      redirect_to root_path
    else
      #
    end
  end

  private

  def help_params
    params.require(:help).permit(:name, :email, :messages)
  end
end

和我的部分 _help_request.html.slim

div id="help_request"
  h1 Help form
  hr
  = form_for Help.new, as: :post, url: help_request_path do |f|

    = f.label :name
    br
    br
    = f.text_field :name, class: 'form-control',
                          placeholder: 'your name'

    = f.label :email
    br
    br 
    = f.text_field :email, class: 'form-control',
                           placeholder: 'your email'

    = f.label :messages
    br
    br 
    = f.text_area :messages, class: 'form-control',
                             placeholder: 'your message'
    br
    br
    = f.submit 'Send', class: 'btn btn-primary'

我认为这是因为您的表单声明中的 as: :post。似乎 params[:post] 存在,但不存在 params[:help]