class Negroni::Models::MissingAttribute

Raised if a required attribute is missing.

Public Class Methods

new(attributes) click to toggle source

Create a MissingAttribute error with a list of attributes

Calls superclass method
# File lib/negroni/models.rb, line 11
def initialize(attributes)
  @attributes = attributes
  super(message)
end

Public Instance Methods

message() click to toggle source

The error message

# File lib/negroni/models.rb, line 17
def message
  verb, s = @attributes.count > 1 ? %w(are s) : ['is']
  list = @attributes.join(', ')

  "The following attribute#{s} #{verb} missing on your model: #{list}"
end