class ImmutableValidator

Public Instance Methods

validate_each(record, attribute, _value) click to toggle source
# File lib/immutable_validator.rb, line 2
def validate_each(record, attribute, _value)
  return if record.new_record?
  return unless record.public_send("#{attribute}_changed?")
  record.errors.add(attribute, options[:message] || :immutable)
end