# Validating a non-object attribute in a form via checkbox?

**URL:** <https://www.ruby-forum.com/t/validating-a-non-object-attribute-in-a-form-via-checkbox/63101>\
**Category:** Rails\
**Created:** [June 12, 2006, 6:18am UTC](https://www.ruby-forum.com/t/validating-a-non-object-attribute-in-a-form-via-checkbox/63101 "2006-06-12T06:18:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 12, 2006, 6:18am UTC](https://www.ruby-forum.com/t/validating-a-non-object-attribute-in-a-form-via-checkbox/63101/1 "2006-06-12T06:18:23Z")

</div>

Hi there

A user can place an ad with various attributes via a form; however, I  
want the user to check a box signifying that they’ve read the terms  
and conditions for use of the site.

So the ‘terms’ is not an attribute of the Advertisement model. I  
could check that the user has ticked the box in my controller but  
would like to bundle this up with the validation process.

How to ensure that the checkbox is ticked before the ad object is  
saved as part of the model validation?

Any clues appreciated

Richard S.

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 12, 2006, 9:20am UTC](https://www.ruby-forum.com/t/validating-a-non-object-attribute-in-a-form-via-checkbox/63101/2 "2006-06-12T09:20:15Z")

</div>

Should the terms perhaps be part of the user model – it could then be  
part of the user validation (using _validates\_acceptance\_of)_?

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 14, 2006, 1:06am UTC](https://www.ruby-forum.com/t/validating-a-non-object-attribute-in-a-form-via-checkbox/63101/3 "2006-06-14T01:06:58Z")

</div>

Ah, validates\_acceptance\_of !!  
That works fine and is exactly what I was after.

many thanks

Richard
