We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bdab7b1 commit d93bfacCopy full SHA for d93bfac
activemodel/lib/active_model/errors.rb
@@ -289,6 +289,13 @@ def to_hash(full_messages = false)
289
# # => NameIsInvalid: name is invalid
290
#
291
# person.errors.messages # => {}
292
+ #
293
+ # +attribute+ should be set to <tt>:base</tt> if the error is not
294
+ # directly associated with a single attribute.
295
296
+ # person.errors.add(:base, "either name or email must be present")
297
+ # person.errors.messages
298
+ # # => {:base=>["either name or email must be present"]}
299
def add(attribute, message = :invalid, options = {})
300
message = normalize_message(attribute, message, options)
301
if exception = options[:strict]
0 commit comments