开发者

String concatenation in the Helper in Rails

开发者 https://www.devze.com 2023-01-26 04:38 出处:网络
I am trying to append the string in the helper function . content_tag(:span, :class => \"a\") do user.designation end +

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 u开发者_开发技巧ser.designation and user.number.

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

when i put like above i am getting error ..

How to resolve this ..


Use the concat helper:

concat(content_tag(:span, :class => "a") { user.designation })
0

精彩评论

暂无评论...
验证码 换一张
取 消