我可以採用某些activeRecord模型的.save方法並向其添加功能嗎?我還想使用該功能中保存的項目的一些屬性擴展model.save方法Rails
我可以做類似的事嗎?
class Item < ActiveRecord::Base
def self.save
<added stuff for save>
<including some_other_id_from_this_item>
end
end
還是會破的東西?我怎樣才能真正訪問this_item.the_column_i_need?
它幫助你嗎? – Anatoly