![]() |
Rails has very nice features to validate a model (directly mapped on your database). However it gets sometimes sloppy if you don't know the exact command to do your validation.Here's a trick I had a hard time to find. |
validates_uniqueness_of :dateIf you now want to validate the uniqueness of a couple (ex: date,user_id) here's how you can:
validates_uniqueness_of :date, :scope => :user_id
Categories:
Ruby on Rails |
2 comments
»


I spent some time trying to find the answer to this one