Forum: Ruby on Rails simple output string

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sebastian S. (Guest)
on 2006-03-29 02:25

I am new to Rails and wanted to know how I can print an easy
I wanted to generate a dynamic title for my blog articles made with

The first part of the html-title stays the same:


if it is not the mainpage ("softrockcookie") it shall add the
page_title, so:

<title>softrockcookie <%= page_title unless page_title ==
"softrockcookie" %></title>

it worked so far...

and now, to seperate the two parts i wanted a double-doublepoint ("::"),
but couldn't implement it yet. however, I tried it that way and got an

  <%= unless page_title == "softrockcookie"
             print " :: "

no clue how to do it the right way... could you please help a poor noob?
thank you!
Sebastian F. (Guest)
on 2006-03-29 03:19
(Received via mailing list)
you can never use a print or puts method in an ERB template (or
anywhere else in Rails for that matter).

To achieve what you're asking, you could, eg, interpolate the
page_title variable like this:

<title>softrockcookie<%= " :: #{page_title}" unless page_title ==
"softrockcookie" %></title>


> <title>softrockcookie <%= page_title unless page_title ==
> "softrockcookie" %></title>
This topic is locked and can not be replied to.