Skip to content

Instantly share code, notes, and snippets.

@markahesketh
Created April 12, 2012 17:18
Show Gist options
  • Save markahesketh/2369279 to your computer and use it in GitHub Desktop.
Save markahesketh/2369279 to your computer and use it in GitHub Desktop.
# /app/controllers/store_controller.rb
class StoreController < ApplicationController
def index
@products = Product.all
session[:counter] ||= 0
@count = session[:counter] += 1
end
end
# /app/views/store/index.html.erb
...
<h2>The count <%= count %></h2>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment