Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment