Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Dena G
441 PointsRemove 'Follow' button from the current users profile so they can't follow themselves?
Hi all. How can I remove the 'Follow' button from the individuals own profile? (The person who is currently logged in) I don't want them to be able to follow themselves. Thanks in advance!
User / Show
<% provide(:title, @user.name) %>
<div class="row">
<aside class="span4">
<section>
<h1>
<%= image_tag @user.avatar.url(:thumb) %>
<%= @user.name %>
</h1>
<section>
<%= render 'users/stats' %>
</section>
<% if current_user.following?(@user) %>
<%= render 'users/unfollow' %>
<% else %>
<%= render 'users/follow' %>
<% end %>
1 Answer

Maciej Czuchnowski
36,441 PointsI would go for an unless
statement around the follow button, something like:
<% unless @user == current_user %>
...
<% end %>
Dena G
441 PointsDena G
441 PointsAhh I had <% unless user == current_user %>. I was missing the @ symbol. Thank you so much again!!!