Sha256: 84a7915910730ca3a8b5d6d4760888049607f76edc840b9b699a3a3fb9b019e9

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

# Backport of `reorder` method from Origin 2.1.0+
if defined?(Origin::Optional) && !Origin::Optional.method_defined?(:reorder)
  module Origin
    module Optional

      # Instead of merging the order criteria, use this method to completely
      # replace the existing ordering with the provided.
      #
      # @example Replace the ordering.
      #   optional.reorder(name: :asc)
      #
      # @param [ Array, Hash, String ] spec The sorting specification.
      #
      # @return [ Optional ] The cloned optional.
      #
      # @since 2.1.0
      def reorder(*spec)
        options.delete(:sort)
        order_by(*spec)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
by_star-4.0.1 lib/by_star/orm/mongoid/reorder.rb