我有一些红宝石课
class MyClass
include Tire::Model::Persistence
attr_accessor :date
mapping do
index_name Proc.new{|o| "my_class_#{o.date_index}" } # How to?
end
def initialize(d)
@date = d
end
def date_index
@date.strftime("%m%y")
end
end
初始化类后,如何动态设置 index_name?
红宝石 (1.9.3) 轨道 (3.2.3) 轮胎 (0.4.2)