Syntax Error in find()


#1

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

#2

On 4/4/06, Arch S. 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


#3

James L. wrote:

On 4/4/06, Arch S. 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!