Hi there
I'm developing an application which makes use of RoR's polymorphic associations to associate several components with a single product, like so:
class Product < ActiveRecord::Base has_many :line_items, :before_add => :validate_addition end
class LineItem < ActiveRecord::Base belongs_to :product belongs_to :resource, :polymorphic => true end
class Circuit < ActiveRecord::Base has_one :line_item, :as => :resource end
class UserAccount < ActiveRecord::Base has_one :line_item, :as => :resource end
I'd like to be able to obtain a list of the objects which act as a resource for use in the interface. I could do this from the database like so: