我正在尝试创建一个模型,在该模型中我将在两个位置使用相同的资源:
class AttachmentFileComment < ActiveRecord::Base
attr_accessible :action_type
belongs_to :attachments, :conditions=>['attachments.attachable_type=?', 'project']
belongs_to :users
belongs_to :approval_level
belongs_to :comments
belongs_to :attachments, :as=> :file_id, :conditions=>['attachments.attachable_type=?', 'attachment']
end
对于上面我如何编写迁移