Reputation: 107
I've been looking for this and can't seem to find a solution:
I have a content_tag block with a lot of logic in a helper (probably not great, but it is what it is). There's a variable in there that needs to increment. However, the code like this
num = num + 1
Actually ends up outputting num + 1 instead of incrementing it. Is there a way to temporarily evaluate that expression instead of outputting it in the buffer?
Thanks
Upvotes: 0
Views: 229
Reputation: 35533
The content_tag
helper will return the result of the block, which will be the last line inside the block. I am guessing that you're incrementing code is the last line - try moving the output string after this line.
Upvotes: 1