嗨,我是在 Rails 中设计的新手 我创建了 2 个帐户,我登录了我的第二个帐户,但它仍然显示我创建的第一个帐户的数据。什么是正确的声明,以便他们只显示在特定帐户上创建的数据?
<% if @user== current_user %>
<h1> Welcome <%=current_user.email%></h1>
<button class="button"><%= link_to 'Signout',destroy_user_session_path,method: :delete,data:
{confirm:"Sign out now?"}%></button>
<%else%>
<button class ="button"><%= link_to 'Sign in', new_user_session_path %></button>
<button class ="button"><%= link_to 'Sign up', new_user_registration_path %></button>
<%end%>