Exception: Mongoid::SleepingKingStudios::HasTree::Errors::MissingAncestor

Inherits:
Error
  • Object
show all
Defined in:
lib/mongoid/sleeping_king_studios/has_tree/errors.rb

Overview

Since:

  • 0.2.0

Instance Method Summary collapse

Constructor Details

#initialize(relation_name, ancestor_id) ⇒ MissingAncestor

Returns a new instance of MissingAncestor

Since:

  • 0.2.0


9
10
11
12
13
14
# File 'lib/mongoid/sleeping_king_studios/has_tree/errors.rb', line 9

def initialize relation_name, ancestor_id
  message = Array === ancestor_id ?
    "#{relation_name.to_s.pluralize} with ids" :
    "#{relation_name.to_s.singularize} with id"
  super "unable to find #{message} #{ancestor_id.inspect}"
end