Forum: Ruby Accessing an ActiveRecord object's validation list...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
41766db69b8b6825f31a04995f9b9a90?d=identicon&s=25 Michael Cowden (Guest)
on 2007-01-29 22:54
(Received via mailing list)
Is there a way to access an ActiveRecord object's validation list?
for instance:

u = User.find 1
u.attributes.each { |attr| puts attr if u.validates_presence_of?(attr) }

I'm building a test_scaffold generator and I want to access the list of
validations for a model so that I can build the appropriate tests.


-Michael Cowden
 (443) 519-8662
This topic is locked and can not be replied to.