Exception: Negroni::Models::MissingAttribute
- Inherits:
-
StandardError
- Object
- StandardError
- Negroni::Models::MissingAttribute
- Defined in:
- lib/negroni/models.rb
Overview
Raised if a required attribute is missing.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ MissingAttribute
constructor
Create a MissingAttribute error with a list of attributes.
-
#message ⇒ Object
The error message.
Constructor Details
#initialize(attributes) ⇒ MissingAttribute
Create a MissingAttribute error with a list of attributes
11 12 13 14 |
# File 'lib/negroni/models.rb', line 11 def initialize(attributes) @attributes = attributes super() end |
Instance Method Details
#message ⇒ Object
The error message
17 18 19 20 21 22 |
# File 'lib/negroni/models.rb', line 17 def verb, s = @attributes.count > 1 ? %w(are s) : ['is'] list = @attributes.join(', ') "The following attribute#{s} #{verb} missing on your model: #{list}" end |