我知道這已被回答,但我已經通讀了其中大部分,我仍然無法弄清楚。有人知道發生了什麼嗎?語法錯誤,意外的keyword_else,期待輸入結束其他^
<% if current_user.try(:email) == Join.all(:email) %>
<div class="panel-default">
<div class="panel-body">
You're already signed up for this month! Thanks!
</div>
</div>
<% else %>
<% if user_signed_in? %>
<%= form_for @join do |f| %>
<%= f.email_field :email, value: current_user.email, class: "form-control input-lg", id: "join" %> <br>
<%= f.submit "Join This Month's Rewards", class: "btn btn-success btn-lg" %>
<% end %>
<% end %>
<% else %>
<div class="panel panel-default">
<div class="panel-body">
Sorry, you're not currently signed in, so you can't sign up for our rewards. You can sign in <a href="https://stackoverflow.com/users/sign_in">here.</a>
</div>
</div>
<% end %>
以下是完整的錯誤:/Users/Sam/Documents/workspace/rewardsApp/app/views/joins/new.html.erb:19: syntax error, unexpected keyword_else, expecting keyword_end else ^
的錯誤是在第29行,這是後<% else %>
兩個<% end %>
幫助最感謝!
您應該提供完整的錯誤。 – Laurel
@Laurel我修好了......你知道這個問題是什麼嗎?我討厭尋求幫助,但我很困難。 – GOAT