How do we add comments in erb files, if we do not want them to be generated into the html content?
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
相关文章
- Ruby using wrong version of openssl
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
For block comments:
Use the
<%# %>
sequence, e.g.For Record
Since .erb is by definition "embedded ruby", you can embed every ruby code between:
<%=
and the other:%>
, typically all written in one line. In addition, ruby one-line comments start always with#
, so the<%=# Comment %>
style matches perfectly with both pure-ruby and erb styles for one-line comments.I have a Windows setup, and this <%-# %> sequence is the only one that works for me:
Example: