Forum: Ruby on Rails Concatenation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Buntin, Seth - KATE (Guest)
on 2006-02-13 22:41
(Received via mailing list)
I have this:



<%= @tech_standard.category + " " + @tech_standard.point + "." +
@tech_standard.subpoint %>



I get this error:



cannot convert Fixnum into String



point and subpoint are number.



How do I concatenate those values?





Seth B.

Web Resources Coordinator

Kentucky Academy of Technology Education

Murray State University
Jason P. (Guest)
on 2006-02-13 22:52
(Received via mailing list)
On Feb 13, 2006, at 2:40 PM, Buntin, Seth - KATE wrote:

>
>
>
> cannot convert Fixnum into String
>
>
> point and subpoint are number.
>
>
>
> How do I concatenate those values?

@tech_standard.category + @tech_standard.point.to_s +
@tech_standard.subpoint.to_s

Or if you actually want to add the numbers first and then concatenate
their sum to the category string:

@tech_standard.category + (@tech_standard.point +
@tech_standard.subpoint).to_s

--
Jason P.
This topic is locked and can not be replied to.