I am trying to extend clearances controllers to pass through some other form elements
I have currently done the following but it doesn't appear to be working and is returning ActiveModel::ForbiddenAttributesError
class UsersController < Clearance::UsersController
private
def user_from_params
params.require(:user).permit(:first_name, :last_name, :mobile, :email, :password, :password_confirmation)
end
end
The create action calls user_from_params
, which explicitly calls the Clearance user_params
to validate strong parameters. The user_from_params
that defined in the derived class is not getting called, hence the exception.
You can name the strong parameters method in your derived class user_params
. The derived method will then simply override the method of the same name in the base class, regardless of the fact that the base method is private.