开发者

Rails 3 i need some help with making a FAQ page

开发者 https://www.devze.com 2023-02-06 09:12 出处:网络
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

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

精彩评论

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