覆盖ActiveResource属性setter

时间:2012-04-06 08:33:04

标签: ruby-on-rails ruby

有没有办法在初始化对象时覆盖activeresource上的属性setter?

1 个答案:

答案 0 :(得分:1)

您可以尝试覆盖加载方法

 def load(attributes, remove_root = false)
       super(attributes, remove_root)
       #put your code,  here you have @attributes collection
       self
    end