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: mysql> SELECT DISTINCT resource_type FROM line_items; +---------------+ | resource_type | +---------------+ | Circuit | | UserAccount | +---------------+ which is great if I have at least one line_item acting as a resource, but if I add a new model (IpRange, say) then my SELECT DISTINCT won''t pick it up until there is a record in the database. Does AR provide a handy way of doing this? I can''t see anything obvious. Thanks, Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---