RawnetAdmin expects a #{resource}_params method like the following..
def user_params
params.require(:user).permit(:name, :email)
end
Since the above will throw an error on the new action (as no params are submitted, require(:user) throws a hissy), the permitted_params method will catch the error on new and return an empty hash on new only.
You can override permitted_params instead if you like, just make sure you don't call require in here and use a nested hash instead.
def permitted_params
params.permit(user: [:name, :email])
end
Ultimately, resource_params is the top-level method to obtain the params for the resource. This returns the hash of parameters without the resource key.
This needs documenting ASAP, although it's the same behaviour as InheritedResources
RawnetAdmin expects a
#{resource}_params
method like the following..Since the above will throw an error on the
new
action (as no params are submitted,require(:user)
throws a hissy), thepermitted_params
method will catch the error on new and return an empty hash onnew
only.You can override
permitted_params
instead if you like, just make sure you don't callrequire
in here and use a nested hash instead.Ultimately,
resource_params
is the top-level method to obtain the params for the resource. This returns the hash of parameters without the resource key.This needs documenting ASAP, although it's the same behaviour as InheritedResources