Syntax is killing me! instance var in labels


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

<%= text_field_tag(‘step_1’, ‘enter Task’ @tasks ‘here’, {}) %>

and this:

<%= text_field_tag(‘step_1’, ‘enter Task #{@tasks} here’, {}) %>


<%= text_field_tag(‘step_1’, ‘enter Task @tasks here’, {}) %>

Any help you could provide would be greatly appreciated. Thanks!


<%= text_field_tag(‘step_1’, “enter Task #{@tasks} here”, {}) %>

you need to use double quotes for the string to be evaluated


Hi Mike,

#2 should work if you replace the single quotes with double. Single
mean you want whatever’s inside to be treated literally. If that
fix it, it would help to see what results you’re getting.

Best regards,

see for a
lesson on string interpolations

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs