Module: ClosureTree::DeterministicOrdering

Defined in:
lib/closure_tree/deterministic_ordering.rb

Instance Method Summary collapse

Instance Method Details

#order_valueObject


3
4
5
# File 'lib/closure_tree/deterministic_ordering.rb', line 3

def order_value
  read_attribute(_ct.order_column_sym)
end

#order_value=(new_order_value) ⇒ Object


11
12
13
# File 'lib/closure_tree/deterministic_ordering.rb', line 11

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

#siblings_afterObject


19
20
21
# File 'lib/closure_tree/deterministic_ordering.rb', line 19

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

#siblings_beforeObject


15
16
17
# File 'lib/closure_tree/deterministic_ordering.rb', line 15

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

#update_order_value(order_value) ⇒ Object


7
8
9
# File 'lib/closure_tree/deterministic_ordering.rb', line 7

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