2012-04-06 38 views
1

當初始化對象時,是否有方法覆蓋活動資源上的屬性設置器?覆蓋ActiveResource屬性設置器

+0

正是你想做的事/改變? – 2012-04-06 09:49:58

+0

我想清理其中一個屬性,例如我將使用ActiveRecord write_attribute方法進行清理。我無法找到ARes的等價物 – sailor 2012-04-06 09:59:03

回答

1

你可以嘗試重寫負載方法

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