title: How to check size of session in rails?
body: <p>I would expect <code>session.size</code>, <code>session.length</code> or <code>session.count</code> to work, but they all return "undefined method". Why, isn't <code>session</code> a hash?</p>
  
  <p>That was curiosity. The actual question: is there a way to check the size of session in KB? Currently my sessions are stored in cookies and it has a 4 KB limit, and when it exceeds, it simply stops putting new data in there. It would be nice to know when in happens, to reset the session or remove old data. </p>