I am a little confused about the polymorphic association that I have. I need an article model to have a header image and many images, but I want to have one image model. To make things even more confusing, the image model is polymorphic (so that other resources can have many images).
I use this association in my article model:
class Article < ActiveRecord::Base has_one :header_image, :as => :imageable has_many :images, :as => :imageable end
Is it possible? Thank.
ruby ruby-on-rails activerecord polymorphic-associations
Jamie Rumbelow Jul 22 '09 at 20:29 2009-07-22 20:29
source share