In an admin-only controller for scaffolded forms where we have no concern about mass-assignment, we implemented strong parameters using just the permit! method (no .require() or .permit() ) which should simply sets the params permitted flag to true, whitelisting anything in the params object.
private
def foo_params
params.permit!
end
and in the controller we have
def create
@foo = Foo.new(foo_params)
However, in specs and when running the app, the controller's create method throws the exception:
unknown attribute 'utf8' for Foo
The error goes away if we add .require(:MODEL) eg change the foo_params
private
def foo_params
params.require(:foo).permit!
end
Is .require() supposed required to avoid throwing an exception due to some of the magically-added Rails forms attributes like the utf8 attribute?
(If it makes any difference it's an app upgraded from Rails 3.2 to 4.2 that otherwise works fine.)