Sha256: ca7af1cc1ec46a3c82fea7cc2abab951592141ab55c054d1af74800d9298050c

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 KB

Contents

motion_require '../helpers/has_authorization'
motion_require './_nano_bag_mixin'
motion_require './_finder_mixin'
motion_require './_base_mixin'
motion_require './_sync_mixin'
motion_require './_association_mixin'
motion_require './_dirty_mixin'
motion_require './store'
motion_require './store_extension'
module MotionPrime
  class Model < NSFNanoObject
    include MotionPrime::HasAuthorization
    include MotionPrime::HasNormalizer
    include MotionPrime::ModelBaseMixin
    include MotionPrime::ModelAssociationMixin
    include MotionPrime::ModelSyncMixin
    include MotionPrime::ModelFinderMixin
    include MotionPrime::ModelDirtyMixin
    include MotionPrime::ModelTimestampsMixin

    attribute :bag_key # need this as we use shared store; each nested resource must belong to parent bag
    attribute :id

    def errors
      @errors ||= Errors.new(self.weak_ref)
    end

    def set_errors(data)
      errors.track_changed do
        data.symbolize_keys.each do |key, error_messages|
          errors.set(key, error_messages, silent: true) if error_messages.present?
        end
      end
    end

    def dealloc
      Prime.logger.dealloc_message :model, self
      super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
motion-prime-1.0.7 motion-prime/models/model.rb
motion-prime-1.0.6 motion-prime/models/model.rb
motion-prime-1.0.5 motion-prime/models/model.rb
motion-prime-1.0.4 motion-prime/models/model.rb
motion-prime-1.0.3 motion-prime/models/model.rb
motion-prime-1.0.2 motion-prime/models/model.rb
motion-prime-1.0.1 motion-prime/models/model.rb
motion-prime-1.0.0 motion-prime/models/model.rb
motion-prime-0.9.9.2 motion-prime/models/model.rb
motion-prime-0.9.9.1 motion-prime/models/model.rb