Module: Origin::Optional

Defined in:
lib/by_star/orm/mongoid/reorder.rb

Instance Method Summary collapse

Instance Method Details

#reorder(*spec) ⇒ Optional

Instead of merging the order criteria, use this method to completely replace the existing ordering with the provided.

Examples:

Replace the ordering.

optional.reorder(name: :asc)

Parameters:

  • spec (Array, Hash, String)

    The sorting specification.

Returns:

Since:

  • 2.1.0



17
18
19
20
# File 'lib/by_star/orm/mongoid/reorder.rb', line 17

def reorder(*spec)
  options.delete(:sort)
  order_by(*spec)
end