I am using markaby for the first time and would like to use a variable as a class id. Something along the lines of ...
mab = Markaby::Builder.new
val = 1
id_name = "this_id-#{val}"
mab.p.id_name!, "Hello world"
This, of course, yields
<p id=name>Hello world</p>
and what I am hoping for is
<p id=this_id-1>Hello world</p>
How does one go about doing this?
From stackoverflow
-
You could use the
tag!method like this:id_name = "this_id-#{val}" mab.tag! :p, :id => id_name do "Hello World" endPaul : That did it. Thank you!
0 comments:
Post a Comment