Sha256: 2eb337a0fdc5b20ebec8566a4f68a92a86e87cf9cb3a663d36e2cd8a8265cd95

Contents?: true

Size: 811 Bytes

Versions: 6

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

module DoorkeeperMongodb
  module Compatible
    extend ActiveSupport::Concern

    module ClassMethods
      def transaction(_ = {}, &_block)
        yield
      end

      def table_exists?(*)
        true # Doorkeeper deprecated this
      end

      # Mongoid::Contextual::Mongo#last no longer guarantee order
      # http://www.rubydoc.info/github/mongoid/mongoid/Mongoid%2FContextual%2FMongo:last
      def last
        asc(:id).last
      end
    end

    def transaction(options = {}, &block)
      self.class.transaction(options, &block)
    end

    def update_column(column, value)
      update_attribute(column, value)
    end

    def lock!(_ = true)
      reload if persisted?
      self
    end

    def with_lock(&_block)
      lock!
      yield
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
doorkeeper-mongodb-5.4.0 lib/doorkeeper-mongodb/compatible.rb
doorkeeper-mongodb-5.3.0 lib/doorkeeper-mongodb/compatible.rb
doorkeeper-mongodb-5.2.3 lib/doorkeeper-mongodb/compatible.rb
doorkeeper-mongodb-5.2.2 lib/doorkeeper-mongodb/compatible.rb
doorkeeper-mongodb-5.2.1 lib/doorkeeper-mongodb/compatible.rb
doorkeeper-mongodb-5.2.0 lib/doorkeeper-mongodb/compatible.rb