简体   繁体   中英

Ruby: Form not submit - ActionController::Parameters permitted: false

After adding some gems in my project my form doesn´t create entries anymore.

I added devise and active admin and after that my form submit stopped working. When i try to debug i got that message:

# posts_controller.rb

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

Output:

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

This is the production code:

def create
  @post = Post.new(post_params)

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

It submits the form but no database entry will generated. Any Ideas?

Thanks for your help! I accidentally had a required for an extra field in my controller which doesn't exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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