Adding
validates :terms_of_service, :acceptance => true
Your model should do this. See here for more details .
However, if accepting the conditions is not part of the form for your model, you should use client-side validations, i.e. JavaScript, like this (in jQuery):
function validateCheckbox()
{
if( $('#checkbox').attr('checked')){
alert("you have to accept the terms first");
}
}
script :
<%= javascript_include_tag "my_javascipt_file" %>
:
<%= submit_tag "Submit", :onclick: "validateCheckbox();" %>
: : check_box_tag :checkbox. HTML : <input id="checkbox" . .