Forum: Ruby on Rails validates_associated on has_many :through polymorphic exception

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.
Gerhard (Guest)
on 2008-11-22 15:08
(Received via mailing list)
I have a Company which has_many AddressLinkings as AddressLinkable
(polymorphic). The same Company has_many Addresses through
AddressLinkings. When creating a new Company and defining some
Addresses for it, I want to validate the Addresses as well before
saving anything to the database. The issue is that a
ActiveRecord::RecordInvalid exception is being raised rather than the
actual errors displayed. This baffles me. Why oh why?!?

Here is the code: .

Cheers guys!
Gerhard (Guest)
on 2008-11-22 15:13
(Received via mailing list)
Managed to figure this one out not a full half hour after making the
post. Solution in the Gist.
This topic is locked and can not be replied to.