Rails 3 select_tag does not create DOM elements

I'm trying to use the helper select_tagin Rails 3. I started with a very simple example, copied directly from the documentation

It seems that the correct markup is being created, but the selection does not work - clicking does nothing.

For comparison, I created the same choice in HAML. It works well. Here is the code for both:

-# The select_tag version
= select_tag "count", "<option>1</option><option>2</option><option>3</option><option>4</option>"

-# The HAML version
%select{:name => "count", :id => "count"}
  %option 1
  %option 2
  %option 3
  %option 4

It seems to be select_tagcreating parameters in a string, but not as DOM elements - in Firebug they are just gray, not syntactically highlighted, like the DOM elements in a work item created by HAML.

What a deal?

+5
source share
1 answer

, : .html_safe.

, Rails < > &lt; &gt;, . html_safe : " , , , HTML".

, :

= select_tag "count", "<option>1</option><option>2</option><option>3</option><option>4</option>".html_safe

, , , , .:)

+5

All Articles