11155
(-- --)
1
Rails 3.1.3
I would like to generate something like this.
<div class="alert">
<a class="close" data-dismiss="alert">×</a>
Successful!
</div>
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?
Rails 3.1.3
I would like to generate something like this.
<div class="alert">
<a class="close" data-dismiss="alert">×</a>
Successful!
</div>
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