I've scoured the web for solution, but I can't figure out why this is
not working! I have a terms and conditions check box that user has to
check in order to register with a site, but it seems to just let user
register regardless of the check box status.
Here's what I have:
-----------------------------------------
Model:
validates_acceptance_of :terms_and_conditions, :on
=> :create, :message => "must be accepted."
attr_accessible :terms_and_conditions
-----------------------------------------
View(form):
<%= form.check_box :terms_and_conditions %>
-----------------------------------------
LOG: (skipping other fields with "..." to save space)
Parameters: {"action"=>"create", ..., "user"=>{... ,
"terms_and_conditions"=>"0",... }}
-----------------------------------------
I am seeing in the log (as shown above) that the
"terms_and_conditions"=>"0", when I don't check the box, and
"terms_and_conditions"=>"1", when I check the box.
But either way, it just goes ahead and creates the record, and no
warning when I don't check the box.
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment