I have an Order model which has_many Shipments and has_many Creditcards. In my controller I''m trying to process various search parameters so that I can search on a customer name. I''d like to match on the name in any of the shipments or creditcards. I''m just not sure how to structure the conditions so that the Address table is included since Address belongs_to addressable, :polymorphic => true. TIA, Sean --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I made some progress with the following
Order.find(:all, :include => [{:shipments => :address}, {:creditcards
=> :address}], :conditions => ["lower(addresses.firstname) LIKE
?",
"%frank%])
This works but only for the shipping addresses. but it won''t find the
creditcard address. Any ideas?
TIA,
Sean
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---