0

I am really new to this, so please excuse me if this is a dumb question. I am saving some data using ruby on rails and one of those fields is a background for the divs I am rendering back on load. I created the partial layouts successfully but I have no clue how to embed the background into the div using the ruby variable.

So this is what I would do in jQuery
<div id="bubble" class="bubble" style="background:' + icon + '"></div>

My ruby field is <% event.icon %> ... how do I add it to this div ?


Thank you so much !

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by blocblue
0

Hi,

Assuming your html file has an .rhtml, .erb or basically an extension that will ensure it is run through the ruby parser, then you can do this:

<div id="bubble" class="bubble" style="background: <%= event.icon %>">

</div>

R.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.