Model Validation for record creation in rails
Posted
by Elliot
on Stack Overflow
See other posts from Stack Overflow
or by Elliot
Published on 2010-06-08T13:57:41Z
Indexed on
2010/06/08
14:02 UTC
Read the original article
Hit count: 376
Hey Guys,
Lets say the model for books is:
created_at
user_id (int)
author_id (int)
genre_id (int)
pages (int)
I want to let people change the "created_at" field upon record creation. I also want to make sure that a record can't have the exact same created_at, user_id, and author_id as any other record (i.e. each needs its own date).
Whats the best to perform this type of validation, and how should I go about doing it?
Best,
Elliot
© Stack Overflow or respective owner