Sha256: 3c2822a164c64d639551a8494c8effe3bcace7c1030d9ff9e1e159e667b8879a
Contents?: true
Size: 554 Bytes
Versions: 7
Compression:
Stored size: 554 Bytes
Contents
module Rostra class Ability include CanCan::Ability attr_reader :user def initialize(user) @user = user || User.new if logged_in? can :manage, Question, :user => user can :manage, Answer, :user => user can :manage, Comment, :user => user can :vote, Question cannot :vote, Question, :user => user can :vote, Answer cannot :vote, Answer, :user => user end can :read, :all end private def logged_in? ! user.new_record? end end end
Version data entries
7 entries across 7 versions & 1 rubygems