Exception: Lycra::DocumentNotFoundError
- Inherits:
-
StandardError
- Object
- StandardError
- Lycra::DocumentNotFoundError
- Defined in:
- lib/lycra/errors.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model = nil) ⇒ DocumentNotFoundError
constructor
A new instance of DocumentNotFoundError.
Constructor Details
#initialize(model = nil) ⇒ DocumentNotFoundError
Returns a new instance of DocumentNotFoundError.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lycra/errors.rb', line 16 def initialize(model=nil) @model = model if model.nil? || model.name.nil? msg = <<MSG You must define a corresponding document class for all models utilizing Lycra::Model. For example, if your model is called BlogPost: # /app/documents/blog_post_document.rb class BlogPostDocument include Lycra::Document index_name 'blog-posts' end MSG else msg = <<MSG You must define a corresponding document class for your #{model.name} model. For example: # /app/documents/#{model.name.underscore}_document.rb class #{model.name}Document include Lycra::Document index_name '#{model.name.parameterize.pluralize}' end MSG end super(msg) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
14 15 16 |
# File 'lib/lycra/errors.rb', line 14 def model @model end |