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
的操作吗。。。但是“类型”字段呢