Sha256: 2dcf636d065cc1ce8bfc00a8368dde33c104162f72d2d79a8c38e88341212976

Contents?: true

Size: 358 Bytes

Versions: 1

Compression:

Stored size: 358 Bytes

Contents

module Ixtlan
  module DataMapper
    module Immutable
      def self.included( model )
        model.class_eval do
          validates_with_method :validate_immutable
        end
      end
      def validate_immutable
        if dirty? && ! new?
          [ false, 'object is immutable' ]
        else
          true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ixtlan-datamapper-0.1.0 lib/ixtlan/datamapper/immutable.rb