Enforcing uniqueness constraints
Okay, let's assume I have two database tables, pages and sections. Each page belongs to a section. Each section cannot have two pages with the same filename. Let's assume this is my page model class:
Now, my "validates_uniqueness_of" constraint somewhat works, but for example I can only have one page named "index" regardless of how many sections I have. How would I enforce the rule that the combination of section_id and filename must be unique, rather than just one or the other?
class Page < ActiveRecord::Base