String concatenation in the helper text

1 view
Skip to first unread message

Aruna Chinnamuthu

unread,
Nov 18, 2010, 12:59:42 AM11/18/10
to rubyonra...@googlegroups.com
Hi ,

I am trying to append the string in the helper function .

content_tag(:span, :class => "a") do user.designation end +
content_tag(:span, :class => "b") do user.number end

In the above, i am trying to append strings before the value
user.designation and user.number.

like
do
"Designation : "+ user.designation end +

when i put like above i am getting error ..

How to resolve this ..

--
Posted via http://www.ruby-forum.com/.

Philip Hallstrom

unread,
Nov 18, 2010, 2:28:59 AM11/18/10
to rubyonra...@googlegroups.com
> Hi ,
>
> I am trying to append the string in the helper function .
>
> content_tag(:span, :class => "a") do user.designation end +
> content_tag(:span, :class => "b") do user.number end
>
> In the above, i am trying to append strings before the value
> user.designation and user.number.
>
> like
> do
> "Designation : "+ user.designation end +
>
> when i put like above i am getting error ..

Why can't you do...

content_tag(:span, user.designation, :class => "a") + content_tag(:span, user.number, :class => "b")

?

Reply all
Reply to author
Forward
0 new messages