module Rostra class Ability include CanCan::Ability def initialize(user) @user = user || User.new if @user.can_participate_in_rostra? can :manage, Question, :user => user can :manage, Answer, :user => user can :manage, Comment, :user => user can [:vote, :toggle_following], Question cannot :vote, Question, :user => user can [:new, :vote], Answer cannot :vote, Answer, :user => user end can :read, :all end end end