Gerhard
2008-Nov-21 23:13 UTC
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: http://gist.github.com/27683 . Cheers guys! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gerhard
2008-Nov-22 13:12 UTC
Re: validates_associated on has_many :through polymorphic exception
Managed to figure this one out not a full half hour after making the post. Solution in the Gist. On Nov 21, 11:13 pm, Gerhard <gerhard.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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:http://gist.github.com/27683. > > Cheers guys!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---