Method: ActiveModel::Error#message

Defined in:
activemodel/lib/active_model/error.rb

#messageObject

Returns the error message.

error = ActiveModel::Error.new(person, :name, :too_short, count: 5)
error.message
# => "is too short (minimum is 5 characters)"

135
136
137
138
139
140
141
142
# File 'activemodel/lib/active_model/error.rb', line 135

def message
  case raw_type
  when Symbol
    self.class.generate_message(attribute, raw_type, @base, options.except(*CALLBACKS_OPTIONS))
  else
    raw_type
  end
end