rails 3 polymorphic association with paperclip and multiple models
问题 I want to make polymorphic associations with paperclip, and allow my user to have one avatar and multiple images. Attachment model: class Attachment < ActiveRecord::Base belongs_to :attachable, :polymorphic => true end class Avatar < Attachment has_attached_file :image, :styles => { :thumb => "150x150>", :view => "260x180>" }, end class Image < Attachment has_attached_file :image, :styles => { :thumb => "150x150>", :view => "260x180>" }, end User Model: has_one :avatar, :as => :attachable,