Exception: Lycra::UndefinedIndexError
- Inherits:
-
StandardError
- Object
- StandardError
- Lycra::UndefinedIndexError
- Defined in:
- lib/lycra/errors.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(document = nil) ⇒ UndefinedIndexError
constructor
A new instance of UndefinedIndexError.
- #subject_name ⇒ Object
Constructor Details
#initialize(document = nil) ⇒ UndefinedIndexError
Returns a new instance of UndefinedIndexError.
50 51 52 53 54 55 56 57 58 |
# File 'lib/lycra/errors.rb', line 50 def initialize(document=nil) @document = document if document.nil? super("You must define an index_name for your document class. Try: `index_name 'my-searchable-things'`") else super("You must define an index_name for your #{document.class.name}. Try: `index_name '#{subject_name.underscore.pluralize}'`") end end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
48 49 50 |
# File 'lib/lycra/errors.rb', line 48 def document @document end |
Instance Method Details
#subject_name ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/lycra/errors.rb', line 60 def subject_name if document.subject.is_a?(Class) document.subject.name else document.subject.class.name end end |