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