Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 456 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'-%>' (minus sign) at the end of a ERb sequence

#1
What's the point of using '-' (minus sign) at the end of a ERb sequence?

Example:

<% 3.times do -%>
FooBar<br />
<% end -%>
Sometext

Regardless of whether I use **'-'** or not, a browser renders the same output.

Thanks, Aplha.
Reply

#2
Using a minus sign on the opening or closing part of an erb tag suppresses whitespace before or after the tag on that line.

It was mainly useful when generating things like text/plain emails with erb but like @Simone pointed out, it's now moot.
Reply

#3
Before Rails 3, ERB adds additional spaces before and after the value when rendering the HTML content. In HTML spaces are not significant, except when you are using special tags such as `<pre>`.

Using the `-` sign forced ERB to avoid additional spaces.

This is completely useless in Rails 3.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through