cancan-attr-test/app/models/ability.rb

10 lines
170 B
Ruby
Raw Permalink Normal View History

2013-06-28 05:22:16 +00:00
class Ability
include CanCan::Ability
def initialize user
user ||= User.new # guest access
can :manage, Post, user_id: user.id
can :read, Post
end
end