Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save edavis10/135962 to your computer and use it in GitHub Desktop.
Save edavis10/135962 to your computer and use it in GitHub Desktop.
class MyController < ApplicationController
def index
@model = MyModel.new
@model.foo = "ABCD"
@model.bar = "1234"
session[:my_stuff] = @model.session_vars
end
def show
session[:my_stuff][:foo] # "ABCD"
session[:my_stuff][:bar] # "1234"
end
end
class MyModel
attr_accessor :foo
attr_accessor :bar
def session_vars
{
:foo => @foo,
:bar => @bar
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment