Search code examples
ruby-on-railsformsactioncontroller

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?


Solution

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