Utilizing rails code to insert HTML and JS into a MySQL database, the rendered code is extracted from the DB and displayed on a customizable page. In the HAML file, embedding Ruby in a JS alert functions correctly:
alert("#{user.id}")
The ID is visible as the user object is passed to this page. However, saving alert("#{user.id}") in the DB and rendering the JS code results in #{user.id} being shown as a string. How can I ensure that the string retrieved from the DB is recognized as Ruby code to be interpreted on the page, revealing the actual user ID like 5 or 6 rather than displaying it as a simple string "#{user.id}"?
Please assist.