Forum: Ruby on Rails human readable controller_name

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.
Sergio T. R. (Guest)
on 2009-02-20 21:41
was wondering if it's possible to have a human readable controller name
in my page title..


if my controller name is: show_names

i can have my view do:

<title> The controller is: <%= controller_name %></title>

and i can get:

<title>The controller is: show_names</title>

but i would like to get:

<title> The controller is: Show Names </title>

Denis H. (Guest)
on 2009-02-20 21:55
(Received via mailing list)
"show_names".humanize => "Show names"

close enough?

Maurício L. (Guest)
on 2009-02-20 21:58
(Received via mailing list)
Or maybe:

<title> The controller is: <%= controller_name.humanize.titleize

Maurício Linhares (pt-br) |
Sergio T. R. (Guest)
on 2009-02-20 22:07
these work great..

i can't figure out why i couldn't find them earlier...

This topic is locked and can not be replied to.