簡體   English   中英

Rails:評論

[英]Rails: comments

我想在application.html.erb中注釋掉某些內容

 <!--
    <div id="user_nav">
 <% if user_signed_in? %>
   Signed in as <%= current_user.email %>. Not you?
   <%= link_to "Sign out", destroy_user_session_path %>
 <% else %>
   <%= link_to "Sign up", new_user_registration_path %> or
   <%= link_to "Sign in", new_user_session_path %>
<% end %>
</div>

//-->

這是不可能的。 怎么辦?

那是HTML注釋; ERB處理在服務器端進行。

<%#

%>

可能跨平台工作,肯定會逐行工作。

也就是說,我不確定是否要通過注釋掉整個部分來刪除功能。

代替考慮或者(a),使用源代碼控制,或(b)呈現的部分和並表示出來,代替ERB的大塊。

對於.html.erb文件,您可以使用以下代碼進行注釋。

<!-- Your Comment here -->

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM