Here is my show.html.erb file.
<% provide(:title, @user.name) %>
<div class="row">
<aside class="span4">
<section>
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>
</section>
<section>
<%= render shared/stats %>
</section>
</aside>
<div class="span8">
<%= render follow_form if signed_in? %>
<% if @user.microposts.any? %>
<h3>Microposts (<%= @user.microposts.count %>)</h3>
<ol class="microposts">
<%= render @microposts %>
</ol>
<%= will_paginate @microposts %>
<% end %>
</div>
</div>
部分文件:
<%= form_for(current_user.relationships.build(followed_id: @user.id),
remote: true) do |f| %>
<div><%= f.hidden_field :followed_id %></div>
<%= f.submit "Follow", class: "btn btn-large btn-primary" %>
<% end %>
• 部分档案:
<%= form_for(current_user.relationships.find_by_followed_id(@user),
html: { method: :delete },
remote: true) do |f| %>
<%= f.submit "Unfollow", class: "btn btn-large" %>
<% end %>
而且,我——以下部分:
<% unless current_user?(@user) %>
<div id="follow_form">
<% if current_user.following?(@user) %>
<%= render unfollow %>
<% else %>
<%= render follow %>
<% end %>
</div>
<% end %>
Edit:我还要说,我用诱杀装置。 当我检查用户页时,两个班次都跨过4级和8级,但有一个完整的空白,即“组合式”。
Edit:这一问题在几年前得到了回答: