search for: find_by_title_and_author_id

Displaying 1 result from an estimated 1 matches for "find_by_title_and_author_id".

2005 Dec 29
3
Verification problems
...ates_uniqueness_of :name end class Book < ActiveRecord::Base belongs_to :author has_many :catalog validates_presence_of :author, :message => "doesn''t exist!" validates_associated :author # Each book title must be unique to each author. def validate if Book.find_by_title_and_author_id(self.title, self.author_id) errors.add(:title, "(#{self.title}) already exists for this author (#{self.author.name})") end end end class Catalog < ActiveRecord::Base belongs_to :book validates_presence_of :book validates_associated :book end NOTE: The above is a c...