http://stackoverflow.com/questions/998979/difference-between-and-in-rails/25617607#25617607
In Ruby 2.1 (not necessarily with Rails), the -
removes one trailing newline:
>
‘-‘
option to use itExamples:
require ‘erb‘
ERB.new("<%= ‘a‘ %>\nb").result == "a\nb" or raise
begin ERB.new("<%= ‘a‘ -%>\nb").result; rescue SyntaxError ; else raise; end
ERB.new("<%= ‘a‘ %>\nb" , nil, ‘-‘).result == "a\nb" or raise
ERB.new("<%= ‘a‘ -%>\nb" , nil, ‘-‘).result == ‘ab‘ or raise
ERB.new("<%= ‘a‘ -%> \nb" , nil, ‘-‘).result == "a \nb" or raise
ERB.new("<%= ‘a‘ -%>\n b" , nil, ‘-‘).result == ‘a b‘ or raise
ERB.new("<%= ‘a‘ -%>\n\nb", nil, ‘-‘).result == "a\nb" or raise
原文:http://www.cnblogs.com/or2-/p/5222130.html