Hello,

I am trying to combine results on two related associations.  I have some
models set up as:

class Vendor < ActiveRecord::Base
  has_many :vendor_staffs
  has_many :vendor_codes, :as => :vendor_codable
end

class VendorStaff < ActiveRecord::Base
  belongs_to :vendors
  has_many :vendor_codes, :as => :vendor_codable
end

class VendorCode < ActiveRecord::Base
  belongs_to :vendor_codable, :polymorphic => true
end

Is there a recommended way to derive this result:

all_vendor_codes = vendor.vendor_codes +
vendor.vendor_staffs.collect.vendor_codes
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to