阅读背景:

Using link_to with post.title in Rails?

来源:互联网 

I have the following code:

我有以下代码:

  <% @posts.each do |post| %>
    <h2>Title: <%= post.title %></h2>
    <p>Author: <%= post.user.username %></p>
    <p>Created At: <%= post.created_at %></p>
    <p>Content: <%= post.content %></p>
    <p>Votes: <%= post.total_votes %></p>
    <p>Comments: <%= post.comments_count %></p>
    <ul>
      <li><%= link_to 'Show', post %></li>
      <li><%= link_to 'Edit', edit_post_path(post) %></li>
      <li><%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %></li>
    </ul>
  <% @po



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: