繁体   English   中英

Ruby:表单未提交-ActionController ::允许的参数:false

[英]Ruby: Form not submit - ActionController::Parameters permitted: false

在我的项目中添加了一些宝石之后,我的表单不再创建条目。

我添加了deviseactive admin ,之后我的表单提交停止工作。 当我尝试调试时,收到该消息:

# posts_controller.rb

def create
  render plain: params[:post].inspect
end

输出:

<ActionController::Parameters {"firstname"=>"Andreas", "lastname"=>"", "street"=>"", "city_code"=>"", "city"=>"", "state"=>"", "country"=>""} permitted: false>

这是生产代码:

def create
  @post = Post.new(post_params)

  if(@post.save)
    redirect_to @post
  else
    render 'new'
  end
end

它提交表单,但不会生成数据库条目。 有任何想法吗?

谢谢你的帮助! 我不小心在我的控制器中有一个不存在的额外字段的要求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM