【发布时间】:2014-06-28 14:42:24
【问题描述】:
我在OpenAir 中为每种类型的模型创建了ActiveRecord 类,并且同步代码已重构为下面的self.run_etl。我想再进一步转化
class OACategory < ActiveRecord::Base
belongs_to :oa_cost_center, foreign_key: :cost_centerid
def to_s
name
end
def self.run_etl(logger=nil)
open_air_type = 'Category'
OAETL.etl(logger, OACategory.table_name, open_air_type) do |xml_node|
OATransform.transform_attributes(OACategory, xml_node)
end
end
end
进入
class OACategory < ActiveRecord::Base
belongs_to :oa_cost_center, foreign_key: :cost_centerid
syncs_with_openair 'Category'
def to_s
name
end
end
请指教。谢谢:)
【问题讨论】:
标签: ruby-on-rails ruby activerecord mixins