Ruby on rails 多态关联,但具有继承的属性名称

Ruby on rails 多态关联,但具有继承的属性名称,ruby-on-rails,polymorphic-associations,Ruby On Rails,Polymorphic Associations,我有以下协会: class ServCost < ActiveRecord::Base belongs_to :servitem, :polymorphic => true end class TourDet < ActiveRecord::Base has _many :serv_costs, :as => servitem end class AdhocBkg < ActiveRecord::Base has _many :serv_costs,

我有以下协会:

class ServCost < ActiveRecord::Base
   belongs_to :servitem, :polymorphic => true
end

class TourDet < ActiveRecord::Base
 has _many :serv_costs,  :as => servitem
end

class AdhocBkg < ActiveRecord::Base
 has _many :serv_costs,  :as => servitem
end
classservcosttrue
终止
类TourDetservitem
终止
类AdhocBkgservitem
终止
我唯一的问题是ServCost中的属性名是:servcostservitemid和servcostservitemtype,我继承了它们,因此无法更改它们。我有什么选择

  • 我可以执行类似于
    :foreign\u key=>:servCostServeItemId
    的操作吗。。。但是“类型”字段呢

  • 从AdhocBkg和TourDet访问ServCost项目的其他方式,反之亦然

  • 我使用的是Rails 3.2和Ruby 1.9