【问题标题】:Rhomobile search questionRhomobile 搜索问题
【发布时间】:2011-08-15 08:58:10
【问题描述】:

我尝试在 Fixed DB 中进行 rhomobile 搜索。

但它会返回 DB 中的所有条目,而不是具有给定 QID 的条目

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

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

   <% end %>
 </ul>

知道为什么吗?

【问题讨论】:

    标签: rhodes rhomobile


    【解决方案1】:

    您需要在第一个参数中传递 :first 或 :all :

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

    或者把方法改成find_all:

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

    【讨论】:

      猜你喜欢
      • 2011-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      • 2012-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多