mercredi 27 avril 2022

When checking the checkbox terms_accepted doesn't change to true

Hey so I have a problem it is probably a very simple thing that I am missing...

So I have a checkbox that a user must tick in order to signup. And when checking the box terms_accepted is not changed to true... anyone got a clue?

here is the migration I made to user:

class AddTermsAcceptedToUsers < ActiveRecord::Migration[6.1]
  def change
    add_column :users, :terms_accepted, :boolean, :default => false
  end
end

This is the validations in user.rb:

  validates :terms_accepted, acceptance: true

this is the simple_form for the checkbox:

  <%= f.check_box :terms_accepted,
                  required: true%>
  <%= label_tag(:owner, "I accept all terms and conditions by checking this box ") %>



Aucun commentaire:

Enregistrer un commentaire