我試圖有條件地顯示基於數據庫中的某些字段的鏈接,但是,根據IF語句和鏈接顯示無論如何都不設置。Rails IF語句不起作用
<% if :mobile.present? && :mobile_verified != true %>
<%= link_to "(Verify Mobile)", :controller => 'users', :action => 'resend_verification', :method=> :post %>
<% end %>
有什麼不正確?
這些都是符號,不是變量。你可能想刪除':'。也許你打算用'@'來加前綴。 – numbers1311407
非常感謝!爲什麼我不能將您的解決方案標記爲答案? – Bill
b/c它是一個評論:-) – numbers1311407