mardi 15 août 2017

simple_format changes the text itself

In Rails 3.0, the helper method simple_format changes the parameter itself. I expected that it only returns the wrapped text.

2.0.0-p648 :001 > Rails.version
 => "3.0.20"
2.0.0-p648 :002 > s = "Hello"
 => "Hello"
2.0.0-p648 :003 > helper.simple_format(s)
 => "<p>Hello</p>"
2.0.0-p648 :004 > s
 => "<p>Hello</p>"

I checked with Rails 4.2 and it doesn't change the text.

Can someone please explain it?

Sam

Aucun commentaire:

Enregistrer un commentaire