class Models::User include Mongoid::Document field :name, type: String include Mongoid::Authorized def anonymous? name == 'anonymous' end class << self def avatar_url *a; end inject current: :user end end