Sha256: 7212c9f8486cbddaf557613fe6c2c73ecb9ce40a560fe32c2a1f2c5e6f9962f8

Contents?: true

Size: 174 Bytes

Versions: 18

Compression:

Stored size: 174 Bytes

Contents

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
trax_model-0.1.0 lib/trax/validators/frozen_validator.rb
trax_model-0.0.99 lib/trax/validators/frozen_validator.rb
trax_model-0.0.98 lib/trax/validators/frozen_validator.rb
trax_model-0.0.97 lib/trax/validators/frozen_validator.rb
trax_model-0.0.96 lib/trax/validators/frozen_validator.rb
trax_model-0.0.95 lib/trax/validators/frozen_validator.rb
trax_model-0.0.93 lib/trax/validators/frozen_validator.rb
trax_model-0.0.92 lib/trax/validators/frozen_validator.rb
trax_model-0.0.91 lib/trax/validators/frozen_validator.rb
trax_model-0.0.9 lib/trax/validators/frozen_validator.rb
trax_model-0.0.8 lib/trax/validators/frozen_validator.rb
trax_model-0.0.7 lib/trax/validators/frozen_validator.rb
trax_model-0.0.6 lib/trax/validators/frozen_validator.rb
trax_model-0.0.5 lib/trax/validators/frozen_validator.rb
trax_model-0.0.4 lib/trax/validators/frozen_validator.rb
trax_model-0.0.3 lib/trax/validators/frozen_validator.rb
trax_model-0.0.2 lib/trax/validators/frozen_validator.rb
trax_model-0.0.1 lib/trax/validators/frozen_validator.rb