Ruby

From wiki.kungfootek.net
Jump to: navigation, search

Little Helper snippets

Finding errant spaces in VIM

^\(\s\s\)\+


Stolen from : http://stackoverflow.com/questions/7996695/what-is-the-difference-between-and-in-erb-in-rails

Executes the ruby code within the brackets.

<% %>

Prints something into erb file or otherwise outputting the results of Ruby code.

<%= %>

Avoids line break after expression.

<% -%>

Comments out code within brackets; not sent to client (as opposed to HTML comments).

<%# %>

The double equal means that the string is not escaped, as in raw.

<%== %>