i validate terms checkbox on form. have implemented folowing: http://guides.rubyonrails.org/active_record_validations.html#acceptance
class user < activerecord::base validates :terms, acceptance: true end i have stripped form checkbox debugging purposes.
regardless of entry passed :terms not validate. form parameters appear being passed correctly.
parameters: {"utf8"=>"✓", "authenticity_token"=>"+1dzwemajqn4cl7kdgjliw2kfsyvk/36eahnhdyduxhlfzyt7lnciugdfzyt3hd/dd7evivmivwepv+7p+scya==", "user"=>{"terms"=>"1"}, "commit"=>"register"} when update validation following receive error stating "terms must accepted" regardless of terms value submitted. leads me believe value form not being passed validation.
validates :terms, acceptance: true, :allow_nil => false
ok...
the problem validation helper validates contents of row within table before saving. trigger needed assign ":terms" value model validation.
i passing params hash "terms" item within expecting validated.
Comments
Post a Comment