Rails 3.1.3
I would like to generate something like this.
I tried,
content_tag :div, msg, :class => “alert alert-success” do
content_tag :a, “x”, :class => “close”, :data-dismiss => “alert”
end
But the problem is the hyphen, “-”, where “:data-dismiss =>…”
Do you think we can avoid this problem?
soichi
Have you tried “data-dismiss”.to_sym?
On Mar 17, 2012, at 4:52 PM, Soichi I. wrote:
I tried,
content_tag :div, msg, :class => “alert alert-success” do
content_tag :a, “x”, :class => “close”, :data-dismiss => “alert”
end
But the problem is the hyphen, “-”, where “:data-dismiss =>…”
Do you think we can avoid this problem?
You can either use a bare string (‘data-dismiss’ => “alert”) or you can
use quotes in the symbol name (:“data-dismiss” => “alert”).
Walter