Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. <% if can? :update, @article %>
  2. <%= link_to "Edit", edit_article_path(@article) %>
  3. <% end %>
  4.  
  5. user.can?(:update, @article)
  6.  
  7. class User < ActiveRecord::Base
  8. def ability
  9. @ability ||= Ability.new(self)
  10. end
  11. delegate :can?, :cannot?, :to => :ability
  12. end
  13.  
  14. user.can?(:update,@article)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement