Skip to content

Instantly share code, notes, and snippets.

@hassox
Forked from benburkert/gist:4798
Created August 11, 2008 03:36
Show Gist options
  • Save hassox/4802 to your computer and use it in GitHub Desktop.
Save hassox/4802 to your computer and use it in GitHub Desktop.
class MyController < Application
cache :show, :index
after nil, :only => :create do
eager_cache :show{ |c| c.params[:id] => @article.id}
eager_cache :index
end
def index
@articles = Article.all
display @articles
end
def show
@article = Article.get(params[:id])
display @article
end
def create
@article = Article.new(params[:article])
if @article.save
redirect url(:article, @article)
else
skip_cache!
render_new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment