【发布时间】:2014-11-12 13:57:18
【问题描述】:
我有一个用户,他的用户列表中有一些朋友。我如何查看他们的个人资料页面?我在哪里可以这样做?我是这样做的:
% @accounts.each do |account| %>
<tr>
<td><%= link_to account.name, account %></td>
但我总是转移到我的 current_account 而不是我想要的用户。
任何帮助将不胜感激。
--已编辑--
这是我的表演课:
<%- model_class = Account -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human.titleize %></h1>
</div>
<dl class="dl-horizontal">
<dd><%= image_tag @account.profile_photo.url %></dd>
<dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
<dd><%= @account.name %></dd>
<dt><strong><%= model_class.human_attribute_name(:gender) %>:</strong></dt>
<dd><%= @account.gender %></dd>
<dt><strong><%= model_class.human_attribute_name(:age) %>:</strong></dt>
<dd><%= @account.age %></dd>
<dt><strong><%= model_class.human_attribute_name("Date Of Birth") %>:</strong></dt>
<dd><%= (@account.year_Of_Birth.to_s) +"/"+(@account.month_Of_Birth.to_s)+"/"+(@account.day_Of_Birth.to_s) %></dd>
<dt><strong><%= model_class.human_attribute_name(:country) %>:</strong></dt>
<dd><%= @account.country %></dd>
<dt><strong><%= model_class.human_attribute_name(:favorite_Sport) %>:</strong></dt>
<dd><%= @account.favorite_Sport %></dd>
<dt><strong><%= model_class.human_attribute_name(:account_id) %>:</strong></dt>
</dl>
【问题讨论】:
-
是
account#show作用域为当前用户吗? -
是的,它是当前用户,我不知道该放什么
标签: ruby-on-rails ruby show