I am using rails code to populate some html and JS code into mysql DB. The code is then fetched from DB and rendered on a configurable page. In the HAML file, When I use ruby code in a JS alert it works fine:
alert("#{user.id}")
the id is displayed because I pass the user object to this page. Now when I save this line alert("#{user.id}") in DB and render the JS code, it alerts #{user.id} as a string. How do I make it realize that the string coming from DB is not just a string, it is some ruby code which needs to be interpreted on the page as I am getting the user object there. So it should display the actual id like 5 or 6 instead of showing a simple string "#{user.id}"
Plz help