我是Sinatra的新手,我试图弄清楚如何查询模板中的集合。在这个特定的例子中,我试图找出是否在特定集合(本例中为c
)的对象中存在具有特定值的对象。Sinatra查询集合
<% if c.votes #then filter by an id for example through all of the objects... %>
yes, it exists
<% else %>
nope, doesn't exist
<% end %>
而且,我已经习惯了Django的过滤器,是有它概述了西纳特拉的各种查询功能相当的联机文档?
您使用的是ORM(AciveRecord,Sequel等),还是'c'只是一个“常规”Ruby数组? – 2012-04-09 00:12:56
我正在使用ORM。 – captDaylight 2012-04-09 00:44:33