This is my show.html.erb
.
I'm just trying to use an if statement within another if, when the provider is the facebook use a specific url , if the provider is google use another method.
<% if current_user %>
<%= if current_user.provider == 'google' %>
<%= image_tag "#{current_user.image}?sz=100", style: "border-radius:50px" %>
<% else %>
<%= image_tag "http://ift.tt/2dy0rC4", style: "border-radius:50px" %>
<% end %>
<%= current_user.name %>
<% else %>
<%= link_to "Logar com o Facebook", "/auth/facebook", id: "sign_in", class: "btn btn-info" %>
<%= link_to "Logar com o Google", "/auth/google_oauth2", id: "sign_in" , class: "btn btn-success" %>
<% end %>
but I'm getting this error:
Facegoogle/app/views/home/show.html.erb:5: syntax error, unexpected ')', expecting keyword_then or ';' or '\n' ...ent_user.provider == 'google' );@output_buffer.safe_append=' ... ^
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:9: syntax error, unexpected keyword_else, expecting ')' '.freeze; else ^
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:13: syntax error, unexpected keyword_end, expecting ')' '.freeze; end ^
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:18: syntax error, unexpected keyword_else, expecting ')' '.freeze; else ^
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:22: syntax error, unexpected keyword_end, expecting ')' '.freeze; end ^
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:24: syntax error, unexpected keyword_ensure, expecting ')'
/home/filipe/Sites/Facegoogle/app/views/home/show.html.erb:26: syntax error, unexpected keyword_end, expecting ')'
Aucun commentaire:
Enregistrer un commentaire