{
    "mode": "ri",
    "parameter": "ActiveModel::Validations",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/ri/ActiveModel%3A%3AValidations/json",
    "generated": "2026-07-29T19:49:05Z",
    "sections": {
        "ActiveModel::Validations": {
            "content": "------------------------------------------------------------------------",
            "subsections": []
        },
        "Includes:": {
            "content": "HelperMethods (from /home/chedong/.local/share/rdoc)\n\n------------------------------------------------------------------------",
            "subsections": []
        },
        "Extended by:": {
            "content": "(from /home/chedong/.local/share/rdoc)\nActiveSupport::Concern\nActiveModel::Naming\nActiveModel::Callbacks\nActiveModel::Translation\nHelperMethods\n\n(from /home/chedong/.local/share/rdoc)\n------------------------------------------------------------------------",
            "subsections": [
                {
                    "name": "Active Model Validations",
                    "content": "Provides a full validation framework to your objects.\n\nA minimal implementation could be:\n\nclass Person\ninclude ActiveModel::Validations\n\nattraccessor :firstname, :lastname\n\nvalidateseach :firstname, :lastname do |record, attr, value|\nrecord.errors.add attr, \"starts with z.\" if value.startwith?(\"z\")\nend\nend\n\nWhich provides you with the full standard validation stack that you know\nfrom Active Record:\n\nperson = Person.new\nperson.valid?                   # => true\nperson.invalid?                 # => false\n\nperson.firstname = 'zoolander'\nperson.valid?                   # => false\nperson.invalid?                 # => true\nperson.errors.messages          # => {firstname:[\"starts with z.\"]}\n\nNote that ActiveModel::Validations automatically adds an errors method\nto your instances initialized with a new ActiveModel::Errors object, so\nthere is no need for you to do this manually.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n------------------------------------------------------------------------"
                }
            ]
        },
        "Instance methods:": {
            "content": "errors\ninvalid?\nraisevalidationerror\nvalid?\nvalidate\nvalidate!\nvalidateswith\nvalidationcontext\n",
            "subsections": []
        },
        "Attributes:": {
            "content": "attraccessor validationcontext\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}