Guest User

Untitled

a guest
Feb 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class MyController < Application
  2.  
  3. cache :show, :index
  4.  
  5. after nil, :only => :create do
  6. eager_cache :show{ |c| c.params[:id] => @article.id}
  7. eager_cache :index
  8. end
  9.  
  10. def index
  11. @articles = Article.all
  12. display @articles
  13. end
  14.  
  15. def show
  16. @article = Article.get(params[:id])
  17. display @article
  18. end
  19.  
  20. def create
  21. @article = Article.new(params[:article])
  22. if @article.save
  23. redirect url(:article, @article)
  24. else
  25. skip_cache!
  26. render_new
  27. end
  28. end
  29. end
Add Comment
Please, Sign In to add comment