Class: FrozenValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/trax/validators/frozen_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



2
3
4
5
6
# File 'lib/trax/validators/frozen_validator.rb', line 2

def validate(record)
  record.changed.any? do |field|
    record.errors[field] << "Cannot be modified"
  end
end