1
我是Rails的新手。我只是腳手架一個小模型。該模型有一個稱爲類別的字段。現在我想按類別過濾索引頁上的條目。在Rails中過濾窗體?
<% form_for @domain do |f| %>
<p>
Domain:
<%= f.select(:Domain,%w{ LifeStyle Automobiles FoodAndBeverage Health IT Telecom EntertainmentAndCelebrity Education BankingInvestmentAndInsurance Travel Sports Parenting ConsumerElectronics RealtyAndLogistics CauseLed})%>
<%= submit_tag "Filter" %>
</p>
<% end %>
<table border="1">
<tr>
<th>Domain</th>
<th>Category</th>
<th>Course detail</th>
<th>Nameofblog</th>
<th>Descriptionofblog</th>
<th>Smename</th>
<th>Smecommuntiy</th>
<th>Smeifnotorkfac</th>
<th>Noofmemb</th>
<th>Discussionforumname</th>
<th>Discussionforumdescription</th>
<th>Qnasitesname</th>
<th>Qnasitesnamedesc</th>
<th>Newssitename</th>
<th>Newssitedesc</th>
</tr>
<% @media_universe_entries.each do |media_universe_entry| %>
<tr>
<td><%=h media_universe_entry.Domain %></td>
<td><%=h media_universe_entry.Category %></td>
<td><%=h media_universe_entry.CourseDetail %></td>
<td><%=h media_universe_entry.NameOfBlog %></td>
<td><%=h media_universe_entry.Descriptionofblog %></td>
<td><%=h media_universe_entry.SMEname %></td>
<td><%=h media_universe_entry.SMECommuntiy %></td>
<td><%=h media_universe_entry.SMEIfnotOrkFac %></td>
<td><%=h media_universe_entry.NoOfMemb %></td>
<td><%=h media_universe_entry.discussionforumname %></td>
<td><%=h media_universe_entry.discussionforumdescription %></td>
<td><%=h media_universe_entry.QNASitesname %></td>
<td><%=h media_universe_entry.QNASitesnameDesc %></td>
<td><%=h media_universe_entry.NewsSiteName %></td>
<td><%=h media_universe_entry.NewsSiteDesc %></td>
<td><%= link_to 'Show', media_universe_entry %></td>
<td><%= link_to 'Edit', edit_media_universe_entry_path(media_universe_entry) %></td>
<td><%= link_to 'Destroy', media_universe_entry, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New media_universe_entry', new_media_universe_entry_path %>
正如你所看到的,我正在嘗試創建一個明智的文件字符串。我該怎麼做呢?