{"record":{"id":"cb4574148312e74b","repo":"thoughtbot/shoulda-matchers","slug":"the-validation-failed-because-your-model-name-m","errorCode":null,"errorMessage":"The validation failed because your #{model_name} model declares `has_secure_password`, and\n`validate_presence_of` was called on a #{record_name} which has `password` already set to a value.\nPlease use a #{record_name} with an empty `password` instead.","messagePattern":"The validation failed because your #(.+?) model declares `has_secure_password`, and\n`validate_presence_of` was called on a #(.+?) which has `password` already set to a value\\.\nPlease use a #(.+?) with an empty `password` instead\\.","errorType":"exception","errorClass":"ActiveModel::CouldNotSetPasswordError","httpStatus":null,"severity":"error","filePath":"lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb","lineNumber":272,"sourceCode":"        end\n\n        def secure_password_being_validated?\n          Shoulda::Matchers::RailsShim.digestible_attribute?(\n            @subject,\n            @attribute,\n          )\n        end\n\n        def possibly_ignore_interference_by_writer\n          if secure_password_being_validated? && RailsShim.active_model_lt_7?\n            ignore_interference_by_writer.default_to(when: :blank?)\n          end\n        end\n\n        def allows_and_double_checks_value_of!(value)\n          allows_value_of(value, @expected_message)\n        rescue ActiveModel::AllowValueMatcher::AttributeChangedValueError\n          raise ActiveModel::CouldNotSetPasswordError.create(model)\n        end\n\n        def allows_original_or_typecast_value?(value)\n          allows_value_of(value, @expected_message)\n        end\n\n        def disallows_and_double_checks_value_of!(value)\n          disallows_value_of(value, @expected_message)\n        rescue ActiveModel::AllowValueMatcher::AttributeChangedValueError\n          raise ActiveModel::CouldNotSetPasswordError.create(model)\n        end\n\n        def disallows_original_or_typecast_value?(value)\n          disallows_value_of(value, @expected_message)\n        end\n\n        def disallowed_values\n          if collection_association?","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/thoughtbot/shoulda-matchers/blob/79cdfbc326e97c9b43991b644434ca53c1f62c4c/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb#L254-L290","documentation":"Error \"The validation failed because your #{model_name} model declares `has_secure_password`, and\n`validate_presence_of` was called on a #{record_name} which has `password` already set to a value.\nPlease use a #{record_name} with an empty `password` instead.\" thrown in thoughtbot/shoulda-matchers.","triggerScenarios":"Thrown at lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb:272 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79cdfbc326e97c9b43991b644434ca53c1f62c4c","analyzedAt":"2026-08-23T09:43:24.200Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}