Active Record and Referential Integrity
Posted by Rick DeNatale Sat, 14 Jul 2007 19:10:00 GMT
Josh Susser just posted a new Rails plugin which adds a validates_existence_of method to ActiveRecord::Base.. The idea is that beyond validates_presence_of, which simply checks that a foreign key field is non-nil, or validates_associated which validates the model referenced by a foreign key, validate_existence ensures that the referenced model exists in the database, no more no less.It’s brand new, but it sure looks like a nice idea.









