Forum: Ruby on Rails RE: 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.
E4c4a05719644c37f02dc5181de7c8c5?d=identicon&s=25 Buntin, Seth - KATE (Guest)
on 2006-02-13 21:55
(Received via mailing list)
Thanks...



That did it.



  _____

From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Hogan, Brian
P.
Sent: Monday, February 13, 2006 2:53 PM
To: rails@lists.rubyonrails.org
Subject: RE: [Rails] Concatenation



I hate that :) It gets you in the views.

.to_s is your friend.



<%= @tech_standard.category + " " + @tech_standard.point.to_s + "." +
@tech_standard.subpoint.to_s %>
Ac1da5d66d51a1c3b843221032247b30?d=identicon&s=25 Eric Goodwin (Guest)
on 2006-02-13 22:00
(Received via mailing list)
Hi,

You shouldn't even need to use to_s if you print it as a string to start
with.
<%= "This is a string with vars in it: #{@tech_standard.category}
#{@tech_standard.point} #{@tech_standard.subpoint}" %>

Eric

Buntin, Seth - KATE wrote:
> *Sent:* Monday, February 13, 2006 2:53 PM
> -----Original Message-----
> @tech_standard.subpoint %>
>
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Eric Goodwin
http://www.ericgoodwin.com
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2006-02-13 22:03
(Received via mailing list)
Bah, thats all old school stuff, and I cringe at its site...try this!
:)

<%= "#{@tech_standard.category}
#{@tech_standard.point}.#{@tech_standard.subpoint }" %>

Ahhh..thats better! And no need for any to_s methods on the way...and
this is all pure Ruby, no Rails magic here.

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