vendredi 4 décembre 2015

How to validate the absence of attributes in Rails 3?

I want to check to see if the user has ticked a "matches_applicant_address" box - Then make sure that there aren't any address details being submitted.

This works in Rails4

validates  :address_line_1, :address_line_2,
:absence => true, :if => Proc.new{matches_applicant_address.present?}

Does anybody know how I could possibly write this without the use of the absence validation method?

Aucun commentaire:

Enregistrer un commentaire