How to check if a string matches another string?

In my rails application, I am trying to check if one line (current_user.email) is equal to another line (@ user.email). How do I do this with an if / else statement? I tried

<% if @current_user.email( =@user.bio ) %> <a href="google.com"> Link </a> <% else %> <% end %> 

but I got a syntax error. to help?

+4
source share
2 answers

Invalid syntax ( =@ . = Intended for assignment and not used when calling a method.

Your if line should look like

 <% if @current_user.email == @user.email %> 
+8
source

<% if @current_user.email == @user.bio %> try this and see.

+2
source

Source: https://habr.com/ru/post/1400683/


All Articles