module Mongoid::ImmutableFields
Private Instance Methods
check_immutability()
click to toggle source
# File lib/mongoid_immutable_fields/immutable_fields.rb, line 19 def check_immutability changed_as_symbols.each do |field| if immutable_field_names.include? field errors.add( field, 'is immutable and cannot be updated' ) self.send :reset_attribute!, field.to_s end end end