Search code examples
rhodesrhomobile

Rhomobile search question


I try to make rhomobile search in Fixed DB.

But it returns ALL entries in DB instead of the ones with given QID

    <%[email protected]%>
<%   @antworts = Antwort.find(:conditions=>{'qid'=>@questions.id})%>
   <% @antworts.each do |antwort| %>

       <li>
         <a href="sdfsdf">
         <%= antwort.antwort %>
         </a>
       </li>

   <% end %>
 </ul>

Any idea why?


Solution

  • You need to pass :first or :all in the first argument:

    Antwort.find(:all, :conditions=>{'qid'=>@questions.id})
    

    Or change the method to find_all:

    Antwort.find_all(:conditions=>{'qid'=>@questions.id})