0
我有以下型号:访问从一个模型类散到其他RoR中
class FileInfo < ActiveRecord::Base
STATUS = {:UNAPPROVED => 1, :APPROVED => 2, :PROCESSED => 3 }
attr_accessible :id, :status
validates :status, :inclusion => {:in => STATUS.values}
end
我要访问STATUS
HashMap的另一个类:
class FileInfoObserver < ActiveRecord::Observer
def after_save(file_info)
if file_info.status.eql? 2 //HERE, I want to access STATUS[:APPROVED]
// Some logic
end
end
end
我该怎么办呢?
尝试FileInfo :: STATUS [@ m.column_name] –