Tuesday, 15 May 2012

ruby on rails - validating checkbox acceptance for a form that doesn't have a model -



ruby on rails - validating checkbox acceptance for a form that doesn't have a model -

i add together validator checkbox, if not accepted form not sent. ideally rails solution.

the form emailed straight admin opposed beingness stored in db, so, in limited rails wisdom assume model validations not work.

here part of form concerned validation.

<%= f.check_box :agree, {}, 'agree', "don't agree" %>

edit

i had tried adding

validates :agree, acceptance: true

but model, wether accepted or not, form keeps failing

thanks in advance

rico

ruby-on-rails forms validation

No comments:

Post a Comment