0
我正在尋找記錄一些保存方法調用的最佳方式。它將保存在另一個數據庫中。我需要記錄模型及其屬性和用戶模型,這應該以某種方式從會話中獲取。如何使它成爲Rails Way?在模型在Rails 3中記錄活動記錄保存方法調用 - 如何
#<User id: nil, name: "hi", created_at: nil, updated_at: nil>
:
我正在尋找記錄一些保存方法調用的最佳方式。它將保存在另一個數據庫中。我需要記錄模型及其屬性和用戶模型,這應該以某種方式從會話中獲取。如何使它成爲Rails Way?在模型在Rails 3中記錄活動記錄保存方法調用 - 如何
#<User id: nil, name: "hi", created_at: nil, updated_at: nil>
:
這個會寫這樣一行在日誌上的每個保存操作
class User <ActiveRecord::Base
before_save :log_attributes
protected
def log_attributes
logger.info self.inspect
end
end
但如何從會議在此解決方案連接用戶? – 2010-09-14 10:05:12
我已經回答了「我需要記錄模型及其屬性和用戶模型」部分。來自會話的用戶是另一回事,這取決於你如何處理你的會話(設計,authlogic,restful_auth ...) – hellvinz 2010-09-14 13:31:46
我有authlogic – 2010-09-17 12:18:45