# What's wrong ... syntax error ... unexpected identifer

**URL:** <https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610>\
**Category:** Rails\
**Created:** [June 19, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610 "2009-06-19T17:39:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 19, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610/1 "2009-06-19T17:39:54Z")

</div>

got this error [rails 2.3.2, Ruby 1.8.7]

syntax error, unexpected tIDENTIFIER, expecting kEND  
… if n.send(order\_attribute) \> self.send(order\_attribute)

idoesn’t like the ‘\>’ … what’s wrong ?

here is my action…

```
  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

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 19, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610/2 "2009-06-19T17:56:25Z")

</div>

> ```
> 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 )

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 19, 2009, 6:03pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610/3 "2009-06-19T18:03:32Z")

</div>

2009/6/19 Erwin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Â Â Â Â Â Â Â else  
> Â Â Â Â Â 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

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 19, 2009, 6:12pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610/4 "2009-06-19T18:12:27Z")

</div>

2009/6/19 Philip H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > here is my action…  
> > 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 ‘\>’  
Colin

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 19, 2009, 6:18pm UTC](https://www.ruby-forum.com/t/whats-wrong-syntax-error-unexpected-identifer/170610/5 "2009-06-19T18:18:58Z")

</div>

On Jun 19, 2009, at 9:11 AM, Colin L. wrote:

> > > (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…
