I need to get some of the data for my models from SOAP based services and some from a rails db. I am relatively new to Rails and not sure how to do it right. class Product < ActiveRecord::Base # products should be loaded through a soap service from a 3rd party system belongs_to :product_group # also loaded through a soap service belongs_to :product_location # this one is a local table end Product.find(params[:id]) #should load data from both soap service and local db please suggest how this should be done. thank you. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 18, 8:42 pm, slava <slava_mike...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> I need to get some of the data for my models from SOAP based services > and some from a rails db. I am relatively new to Rails and not sure > how to do it right. > > class Product < ActiveRecord::Base # products should be loaded > through a soap service from a 3rd party system > belongs_to :product_group # also loaded through a soap > service > belongs_to :product_location # this one is a local table > end > > Product.find(params[:id]) #should load data from both > soap service and local db >ActiveRecord can''t do this. ActiveResource sort of does this for data from appropriate RESTful apis, but it doesn''t do associations. You''d need to keep all of the data locally as far as I can tell. Fred> please suggest how this should be done. thank you.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I understand that ActiveRecord can''t do this be default. But I need this to work, so I will have to modify default behaviour. Please suggest an appropriate route. Do I overwrite find method? do I use something else entirely? I need this to work dynamically. thanks On Mar 18, 3:10 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 18, 8:42 pm, slava <slava_mike...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > I need to get some of the data for my models from SOAP based services > > and some from a rails db. I am relatively new to Rails and not sure > > how to do it right. > > > class Product < ActiveRecord::Base # products should be loaded > > through a soap service from a 3rd party system > > belongs_to :product_group # also loaded through a soap > > service > > belongs_to :product_location # this one is a local table > > end > > > Product.find(params[:id]) #should load data from both > > soap service and local db > > ActiveRecord can''t do this. ActiveResource sort of does this for data > from appropriate RESTful apis, but it doesn''t do associations. You''d > need to keep all of the data locally as far as I can tell. > > Fred > > > please suggest how this should be done. thank you.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---