Validates_associated on has_many :through polymorphic exception

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!

Managed to figure this one out not a full half hour after making the
post. Solution in the Gist.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs