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을 실행 중입니다.
로그온하는 모든 사용자는 사용자 ID를 얻습니다. 그들이 로그인하지 않으면이 사용자 ID는 nil이므로 걱정할 필요가 없습니다. 감사. – Andy