All threads /
Ask A Question


You’re not receiving notifications from this thread.

Penguin asked in Rails


Note:I configured the App with config.action_controller.action_on_unpermitted_parameters = :raise.

Assuming I have a Model Person with attributes :name, :age.

If params = { name: "penguin", age: "99", style: "emperor" }

params.require(:person).permit(:name, :age) will not raise anything because params.require(:person) actually disregard the style: attribute without raising anything and returns { name: "penguin", age: "99" }

Now if I do params.permit(:id, :name, :age, :person => {}), it does raise "found unpermitted parameters: :style".

Is there a way to make .require not filtering the params without raising anything?


I ended up also disabling wrap_parameters: wrap_parameters format: []
So now I can simply do params.permit(:id, :name, :age).

Not sure if there is a better way.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 66,029+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.