iCyborg
iCyborg

Reputation: 4728

How do I add a string to a symbol?

I am still learning Ruby and was using this code on my RoR app:

<title><%= content_for?(:title) ? yield(:title):"" %> - Mysite</title>

I want to add another static word, " - " or " | ", in yield(:title). How to do it?

Upvotes: 1

Views: 68

Answers (1)

dimuch
dimuch

Reputation: 12818

<title><%= content_for?(:title) ? "#{yield(:title)} -" : "" %> - Mysite</title>

Upvotes: 2

Related Questions