In Ruby on Rails 4 while using Devise for User authentication, I am attempting to require Users to select a checkbox at login to verify that they have read and agree to the waiver.
After searching everywhere, I can only find validating a checkbox when registering a User with Devise (through validates :waiver, acceptance: true).
At the moment, in app/views/devise/sessions/new.html.erb, I have the following:
<%= f.check_box :agreed_to_waiver %>
<%= f.label :agreed_to_waiver, 'I have read and fully understand ', autocomplete: "off", class: "control-label" %>
<a class="show_hide">the agreement</a>.
So far, I have attempted to override Devise's default session controller's create method with the following:
def create
super
current_user.update_attributes(waiver: params[:waiver])
end
After that, I was using a few checks within the after_sign_in_path_for(resource) method.
Nothing seems to be working for me. Is there a proper way to check if a checkbox is checked at sign in while using Devise?
Thank you in advance, Kyle Thompson
Aucun commentaire:
Enregistrer un commentaire