开发者

Rails 3 i need some help with making a FAQ page

first off ive tried google and cant seem to find an answer i can understand what i would like to do is list my questions from an active record witch i have that much working then make the question its self a link so her is my page so far!

   <h1>Listing faqs</h1>

<table>

<% @faqs.each do |faq| %>
  <tr><td width="90px"><div id="right">Question : </div></td><td><%= faq.question %></td></tr> 

<% end %>
</table>

<br />

<table>

<% @faqs.each do |faq| %>
  <tr><td width="90px"><div id="right">Question : </div></td><td><%= faq.question %></td></tr>
  <tr><td valign="top"><div id="right">Answer : </div></td><td><%= faq.answer %></td></tr>  
<% end %>
</table>

<br />

<%= link_to 'New Faq', new_faq_path %>

im amusingenter code here i can stick something in before faq.questio开发者_Python百科n like a link_to or something or something but im not shure what


First of all, in Rails 3 forms should start with <%=, not <%.

<%= @faqs.each do |faq| %>
  <tr>
    <td width="90px">
      <div id="right">Question : </div>
    </td>
    <td>
      <%= link_to(faq.question, faq_path(faq.id) %>
    </td>
  </tr> 
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜