html - How can <p> display a variable -
is there way can load variable in 'p' tag?
in test.html.erb:
<p>"#{@variable}"</p>
and in test_controller.rb
@variable = "testing"
however, in html, displays "#{@variable}".
how should fix it?
you need print code , interpolate it, try with:
<p><%= "#{@variable}" %></p>
or <p><%= @variable %></p>
, depending on want do, can interpolate variables.
with <p>"#{@variable}"</p>
you're printing plain html, nothing being interpreted ruby.
Comments
Post a Comment