Skip to content

Instantly share code, notes, and snippets.

@ggoodale
Created June 10, 2009 00:12
Show Gist options
  • Save ggoodale/126921 to your computer and use it in GitHub Desktop.
Save ggoodale/126921 to your computer and use it in GitHub Desktop.
>> class Session < ActiveRecord::Base; end # So we can access the sessions table directly
=> nil
>> s = Session.first
=> #<Session id: 1, session_id: "bd0568033d143fafaa1f9752c43b61d7", data: "BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g...", created_at: "2008-12-10 15:50:58", updated_at: "2008-12-10 17:50:47">
>> session_data = Marshal.load(Base64::decode64(s.data))
=> {"flash" => {}}
>> Rails.cache.write("rack:session:#{s.session_id}", session_data)
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment