daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Apr 20th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #initializers/authorization.rb
  2. class AR::Base
  3.   def editable_by(user)
  4.      user.owns?(self) || user.is_admin?
  5.   end
  6.  
  7.   def destroyable_by(user)
  8.     editable_by(user)
  9.   end
  10.  
  11.   #etc...
  12. end
  13.  
  14. #app/models/note.rb
  15. class Note < AR::Base
  16.   #def editable_by(user);end
  17.  
  18.   def destroyable_by(user)
  19.      super(user) && comments.empty?
  20.   end
  21.  
  22.   #etc...
  23. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top