Rails can only get a hold of information that you send to it, so you'll need to encode this state information on the query string and have your rails controllers handle it along with the rest of the request params.
In the case if your frames example, you'll need to attach some sort of information on the query string to let it know that you're loading the action up in a frame.
e.g.: <script> frames[0].location = "/controller/action?frame=true"; // or something similar
var pairs = ; for (var p in state) pairs.push(escape(p + "=" + state[p]); frames[1].location = "/controller/action?state=" + pairs.join(','); </script>
in your controller, get the state by decoding the junk you encoded: state = params[:state].split(',').map { |s| s.split('=') }.inject({}) {|h,k| h[k.first] = k.last; h}