def move_to_ordered_child_of(parent, order_attribute,
ascending=true)
if parent
left = nil
parent.children.each do |n|
if ascending
left = n if n.send(order_attribute) < self.send
(order_attribute)
else
left = n if n.send(order_attribute) > self.send
(order_attribute)
end
end
self.move_to_child_of(parent)
if left
self.move_to_right_of(left)
elsif parent.children.count > 1
self.move_to_left_of(parent.children[0])
end
else
self.move_to_root
end
end
It does not give me a syntax error. Try putting it as near the start
of the file as possible in case the error is actually earlier in the
file but not picked up till here, though not sure what that could be.
Colin
def move_to_ordered_child_of(parent, order_attribute,
ascending=true)
if parent
left = nil
parent.children.each do |n|
if ascending
left = n if n.send(order_attribute) < self.send
(order_attribute)
Try...
left = n if ( n.send(order_attribute) < self.send )
def move_to_ordered_child_of(parent, order_attribute,
ascending=true)
if parent
left = nil
parent.children.each do |n|
if ascending
left = n if n.send(order_attribute) < self.send
(order_attribute)
Try...
left = n if ( n.send(order_attribute) < self.send )
It is not that line that is blowing up, it is the one below with '>'
Heh. Good point. Same thing would apply below though... Assuming
like someone else said that it is this piece of code and not some
other ">" somewhere...