class Ability
  include CanCan::Ability

  def initialize(user)
    can [:read, :day, :tagged], Post
    can :read, User

    if user.present?
      can :manage, Post, domain: user.domain
      can :manage, User, id: user.id

      can :manage, TimelineEntry, user_id: user.id
      can :manage, Friendship, user_id: user.id
    end
  end
end

class Ability
  include CanCan::Ability

  def initialize(user)
    can [:read, :day, :tagged], Post
    can [:read, :flair], User

    if user.present?
      can :manage, Post, domain: user.domain
      can :manage, User, id: user.id

      can :manage, TimelineEntry, user_id: user.id
      can :manage, Friendship, user_id: user.id
    end
  end
end

Enable /user-flair.jpg for logged-out users. Sorry!
Enable /user-flair.jpg for logged-out users. Sorry!