class Shoulda::Matchers::ActiveModel::CouldNotSetPasswordError

Attributes

model[RW]

Public Class Methods

create(model) click to toggle source
Calls superclass method Shoulda::Matchers::Error.create
# File lib/shoulda/matchers/active_model/errors.rb, line 23
def self.create(model)
  super(model: model)
end

Public Instance Methods

message() click to toggle source
# File lib/shoulda/matchers/active_model/errors.rb, line 29
        def message
          "The validation failed because your #{model_name} model declares `has_secure_password`, and
`validate_presence_of` was called on a #{record_name} which has `password` already set to a value.
Please use a #{record_name} with an empty `password` instead.
".strip
        end

Private Instance Methods

model_name() click to toggle source
# File lib/shoulda/matchers/active_model/errors.rb, line 39
def model_name
  model.name
end
record_name() click to toggle source
# File lib/shoulda/matchers/active_model/errors.rb, line 43
def record_name
  model_name.humanize.downcase
end