Reputation: 65
In my rails app, I'm trying to check if one string (current_user.email) is equal to another string, (@user.email). How would I do this with an if/else statement? I tried
<% if @current_user.email([email protected]) %>
<a href="google.com"> Link </a>
<% else %>
<% end %>
but I got a syntax error. help?
Upvotes: 5
Views: 10445
Reputation: 11375
The invalid syntax is (=@
. The =
is for assignment and has no use in method invocation.
Your if
line should look like
<% if @current_user.email == @user.email %>
Upvotes: 9