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?
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 %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With