4
我在從活動記錄存儲中刪除時遇到問題。活動記錄存儲刪除
我想基於會話數據刪除:
ActiveRecord::SessionStore::Session.find(:all).each do |s|
if s.data[:userid] == 1234
s.destroy
end
end
似乎並沒有工作,但:
ActiveRecord::SessionStore::Session.delete_all(["updated_at < ?", 12.hours.ago])
似乎工作和:
ActiveRecord::SessionStore::Session.find(:all).each do |s|
if s.data[:userid] == 1234
ActiveRecord::SessionStore::Session.delete_all("session_id = ?", s.session_id)
end
end
也犯規工作。
我正在運行的版本軌道2.3.2,紅寶石1.8.7。
每個登錄用戶都獲得一個用戶標識。如果他們沒有登錄,那麼這個用戶名爲零,所以我不需要擔心。謝謝。 – Andy 2010-07-10 23:40:04