簡體   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