Guest User

Untitled

a guest
Apr 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class ApplicationController
  2.  
  3. private
  4. def is_admin?
  5. unless current_user.admin?
  6. flash[:notice] = "You are not allowed here."
  7. redirect_back_or_default root_path
  8. end
  9. end
  10.  
  11. class BlogsController < ApplicationController
  12. before_filter :is_admin?, :except => [:index, :show]
  13. # the opposite to except is only.
  14. end
Add Comment
Please, Sign In to add comment