Polymorphic Associations

Hi,
I'm following the Polymorphic Associations test, issue as following.

I think @image.imageable returns an ActiveRecord Object, which you
can't just display. If you are just testing:

@image.imageable.inspect should dump the active record object the
image is related to.

If you are trying to get an attribute of the imageable relation, since
there can be different relations you have to use the imageable_type to
make sure it is there and use something like @image.imageble.name

But does the image an imageable? how are you saving the image?

I was just talking about polymorphic in general. For images I'd use
something like paperclip.

http://github.com/thoughtbot/paperclip

Then you'd have something like

class Image < ActiveRecord::Base
  include Paperclip
  belongs_to :imageable, :polymorphic => true
  has_attached_file :photo,
    :styles => {
      :thumb=> "100x100",
      :small => "200x200>",
      :medium => "300x300>",
      :large => "400x400>" }

end