miked
February 16, 2007, 5:17pm
1
Hi:
I’ve got a text field tag with a value. In that value, I want to use a
local variable. I can’t seem to get the syntax right. Here’s what I’ve
tried:
<%= text_field_tag(‘step_1’, ‘enter Task’ @tasks ‘here’, {}) %>
and this:
<%= text_field_tag(‘step_1’, ‘enter Task #{@tasks } here’, {}) %>
And
<%= text_field_tag(‘step_1’, ‘enter Task @tasks here’, {}) %>
Any help you could provide would be greatly appreciated. Thanks!
Mike
miked
February 16, 2007, 5:37pm
2
<%= text_field_tag(‘step_1’, “enter Task #{@tasks } here”, {}) %>
you need to use double quotes for the string to be evaluated
-j
miked
February 16, 2007, 5:38pm
3
Hi Mike,
#2 should work if you replace the single quotes with double. Single
quotes
mean you want whatever’s inside to be treated literally. If that
doesn’t
fix it, it would help to see what results you’re getting.
Best regards,
Bil
miked
February 16, 2007, 6:15pm
4
see Ruby | zenspider.com | by ryan davis for a
lesson on string interpolations