Sha256: c9adaadc6e0bc5c1f72961e294340ef33a80e604f3b6432761e49633cd27ad49

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

module Gummi
  module Repository
    extend ActiveSupport::Concern

   included do
     include Repobahn::Repository
     after_conversion :set_id_and_version
   end


    module ClassMethods

      def get(id)
        record = db_model.get id
        to_entity_from_db record if record
      end

      def overwrite(entity)
        return false unless entity.valid?
        db_record = db_model.new(entity.attributes)
        db_record.overwrite
      end

      def set_id_and_version(entity, db)
        entity.id = db.id
        entity.version = db.version
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gummi-0.0.6 lib/gummi/repository.rb