Saturday, June 7, 2008
Hey yo! one class per kitty
Kitty students start to register courses. A student can have many courses and a course can contain many students. Students and courses are many to many relationship via registration.
Now, the problem is, how to make sure each kitty is not registered more once for a particular course.
To do this, use validates_uniqueness_of
Validate the uniqueness of a kitty student id (kitty_id) against a course_id:
Remember! when validating the uniqueness via has_many :through, use specific attribute name instead of model name.
not
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment