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?Code:class Page < ActiveRecord::Base validates_uniqueness_of :filename validates_presence_of :page_title validates_presence_of :page_content end



. I'm off to do some JSP work now but I'll revisit this later tonight
. I'm hoping this weekend will give me more time to work on this.

Bookmarks