这是我的show.html.erb
。
我只是尝试在另一个中使用if语句,如果提供商是Facebook使用特定网址,如果提供商是谷歌使用其他方法。
<% if current_user %>
<%= if current_user.provider == 'google' %>
<%= image_tag "#{current_user.image}?sz=100", style: "border-radius:50px" %>
<% else %>
<%= image_tag "https://graph.facebook.com/#{current_user.uid}/picture?width=60&height=60", 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 %>
但我收到此错误:
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 ')'
答案 0 :(得分:1)
您不应该打印(mutable.Seq
)Google的if语句
更改行:
List
要:
Vector