ActiveModel::StrictValidationFailed

class ActiveModel::StrictValidationFailed

Parent:
StandardError

Raised when a validation cannot be corrected by end users and are considered exceptional.

class Person
  include ActiveModel::Validations

  attr_accessor :name

  validates_presence_of :name, strict: true
end

person = Person.new
person.name = nil
person.valid?
# => ActiveModel::StrictValidationFailed: Name can't be blank

© 2004–2016 David Heinemeier Hansson
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部