Sha256: 05809fadf49eb08da094e205606d5a7ab9089d3f9ecf5026d0b9f5aa1c69833e

Contents?: true

Size: 548 Bytes

Versions: 23

Compression:

Stored size: 548 Bytes

Contents

module ClosureTree
  module DeterministicOrdering
    def order_value
      read_attribute(_ct.order_column_sym)
    end

    def update_order_value(order_value)
      update_column(_ct.order_column_sym, order_value)
    end

    def order_value=(new_order_value)
      write_attribute(_ct.order_column_sym, new_order_value)
    end

    def siblings_before
      siblings.where(["#{_ct.quoted_order_column} < ?", order_value])
    end

    def siblings_after
      siblings.where(["#{_ct.quoted_order_column} > ?", order_value])
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
closure_tree-7.4.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-7.4.0.rc1 lib/closure_tree/deterministic_ordering.rb
closure_tree-7.3.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-7.2.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-7.1.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-7.0.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.6.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.5.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.4.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.3.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.2.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.1.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.0.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-6.0.0.gamma lib/closure_tree/deterministic_ordering.rb
closure_tree-6.0.0.alpha lib/closure_tree/deterministic_ordering.rb
closure_tree-5.2.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-5.1.1 lib/closure_tree/deterministic_ordering.rb
closure_tree-5.1.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-5.0.0 lib/closure_tree/deterministic_ordering.rb
closure_tree-4.6.3 lib/closure_tree/deterministic_ordering.rb