0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

erb でコメントアウトする方法

Posted at

.erb のファイルを編集するとき<%= %>で囲まれた行が、ctrl + / でコメントアウトされないので調べてみた。

"#"を "<%" と "=" のあいだに入れるだけでした。

application.html.erb
<%#= debug(params) if Rails.env.development? %> 

ほかにも方法があるみたいです。

・Ruby の複数行コメント =begin ... =end を使う方法

<% =begin %>
   ...
<% =end %>

・if false で囲う方法

<% if false %>
   ...
<% end %>

参考
https://ja.stackoverflow.com/questions/43321/html-erb%E3%81%A7%E3%81%AE%E3%82%B3%E3%83%A1%E3%83%B3%E3%83%88%E3%82%A2%E3%82%A6%E3%83%88%E3%81%AE%E6%96%B9%E6%B3%95

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?