Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 25th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CanCan Authentication with Exception Logger
  2. config.after_initialize do
  3.   LoggedExceptionsController.class_eval do
  4.     # include any custom auth modules you need
  5.     # (declarative authorization gem used)
  6.     filter_resource_access
  7.     # just add any code you want to be included in the controller ;)
  8.     # optional, sets the application name for the rss feeds
  9.     self.application_name = "Your Application Name"
  10.   end
  11. end
  12.        
  13. load_and_authorize_resource  #everyone gets locked out
  14.  
  15. authorize_resource :class => false  #everyone gets locked out
  16.  
  17. authorize! :roll, :logs  #exception gets raised (undefined method authorized! for LoggedExceptionsController)
  18.        
  19. can :manage, :logged_exceptions