Using rake records with .html.erb files in Rails

I am starting with Rails (3.2.3) and recently discovered the rake notes function.

This works fine for .rb files with comments like this:

# TODO ... 

According to the documentation also works for .erb files. I tried using it in .html.erb view files as follows:

  <!-- TODO ... --> 

But that does not work. Should it? Any ideas on what could go wrong?

Appreciate your help!

+6
source share
3 answers

You do it like this:

 <% #TODO ... %> 

rake notes only detects Ruby comments, so just paste the Ruby comment into your Erb views and you're good to go.

+8
source

When I used <% and # with a space between them, it breaks other HTML elements around the code in Rails version 2.3. However, you should be able to use <% # (without a space), and this is the correct way to have comments in erb, check this: http://en.wikipedia.org/wiki/ERuby

Besides

"Aaah. Got this, I tried <% = #TODO ...%>. Thank you very much. Can you give an idea of โ€‹โ€‹the value of" = "(ie <% = ...%> vs. <%. ..%>? - Derek Hill June 30 at 11:25 pm "

In response to the above question:

The content between <% = ..%> is interpreted and executed as Ruby code, and the result is converted to a string and printed on the output instead of <% = ..%>. While the content between <% ..%> is interpreted and executed as Ruby code with no result displayed on the output.

0
source

TextMate (for Mac) includes a TODO package that detects HTML comments () among other languages

0
source

Source: https://habr.com/ru/post/919391/


All Articles