There is a User (devise) model, there is a checkbox in it - when registering, the user must agree with the Rules. I filled in the checkbox in the form, but for some reason rails does not see the ticked box and still writes that Terms must be accepted. I am somewhere nakosyachil or in the form of the wrong checkbox added?

Model:

validates :terms, acceptance: true 

Scheme:

 t.boolean "terms", default: false 

Users_controller:

 private def user_params params.require(:user).permit(:email, :phone, :address, :terms) end 

Application_controller:

 before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_in, keys: [:phone, :address, :terms]) devise_parameter_sanitizer.permit(:sign_up, keys: [:phone, :address, :terms]) devise_parameter_sanitizer.permit(:account_update, keys: [:phone, :address, :terms]) end 

The form:

 <%= f.label :terms, "Правила" %> <%= f.check_box :terms %> 
  • Look in the logs that comes in the params this request. And it is absolutely incomprehensible why to keep this check in the database. - D-side
  • It seems everything is normal with the checkbox itself, with the "terms" => "1" checkbox pressed, with the "terms" => "0" not pressed. In Terms must be accepted and renders new. - lif3ar

0