Rails 如何点击一个连接能跳到看某个月的数据页面

bruceyue · January 27, 2013 · Last by small_fish__ replied at January 27, 2013 · 2419 hits

如何点击一个连接能跳到看某个月的数据页面

<% @user1rse.each do |month, posts| %>
  <ul>
      <li>
        <%= link_to  A Month Data do %>
          <%= month.strftime('%B %Y') %>(<%= posts.count %>)
        <% end %>
      </li>
  </ul>
  <% end %>

配置一个带有参数的路由,在<%= link_to A Month Data do %>将请求提交到后台,后台获取月份,查寻该月数据,传到 view 中展现。

You need to Sign in before reply, if you don't have an account, please Sign up first.