# Syntax Error in find()

**URL:** <https://www.ruby-forum.com/t/syntax-error-in-find/93549>\
**Category:** Rails\
**Created:** [April 4, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/syntax-error-in-find/93549 "2006-04-04T18:22:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 4, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/syntax-error-in-find/93549/1 "2006-04-04T18:22:16Z")

</div>

Maybe I misunderstand the parameterization of find(), I am getting this  
syntax error for  
\<% @choices = Choic  
e.find(:all, :conditions =\> “question\_id” = question.id, :order =\>  
“order”) %\>

---- ERROR LOG ----

ActionView::TemplateError (compile error  
…/config/…/app/views/admin/test/show.rhtml:37: syntax error  
\_erbout.concat " "; @choices = Choice.find(:all, :conditions =\>  
“question\_id” = question.id, :order =\> “order”) ; \_erbout.concat “\r\n”  
^  
…/config/…/app/views/admin/test/show.rhtml:37: syntax error  
\_erbout.concat " "; @choices = Choice.find(:all, :conditions =\>  
“question\_id” = question.id, :order =\> “order”) ; \_erbout.concat “\r\n”  
^  
…/config/…/app/views/admin/test/show.rhtml:37: syntax error  
\_erbout.concat " "; @choices = Choice.find(:all, :conditions =\>  
“question\_id” = question.id, :order =\> “order”) ; \_erbout.concat “\r\n”  
^)  
on line #37 of app/views/admin/test/show.rhtml:  
34:

  
35: \<%= link\_to question.question, :controller =\> “question”,  
:action =\> “show”, :id =\> question.id %\>  
36:   
37: \<% @choices = Choice.find(:all, :conditions =\> “question\_id” =  
question.id, :order =\> “order”) %\>  
38: \<% @choices.each do |choice| %\>  
39:   
40: \<%= link\_to choice.choice, :controller =\> “choice”,  
:action =\> “show”, :id =\> choice.id %\>

---

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 4, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/syntax-error-in-find/93549/2 "2006-04-04T18:34:25Z")

</div>

On 4/4/06, Arch S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Maybe I misunderstand the parameterization of find(), I am getting this  
> syntax error for  
> \<% @choices = Choic  
> e.find(:all, :conditions =\> “question\_id” = question.id, :order =\>  
> “order”) %\>

It looks like your conditions are messed up.

:conditions =\> [“question\_id = ?”, question.id]

– James

---

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 4, 2006, 6:47pm UTC](https://www.ruby-forum.com/t/syntax-error-in-find/93549/3 "2006-04-04T18:47:30Z")

</div>

James L. wrote:

> On 4/4/06, Arch S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Maybe I misunderstand the parameterization of find(), I am getting this  
> > syntax error for  
> > \<% @choices = Choic  
> > e.find(:all, :conditions =\> “question\_id” = question.id, :order =\>  
> > “order”) %\>
> 
> It looks like your conditions are messed up.
> 
> :conditions =\> [“question\_id = ?”, question.id]
> 
> – James

Ahh I get it thanks!
