Forum: Ruby on Rails human readable controller_name

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.
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-02-20 20:41
was wondering if it's possible to have a human readable controller name
in my page title..

ie:

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>

thanks!
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (Guest)
on 2009-02-20 20:55
(Received via mailing list)
"show_names".humanize => "Show names"

close enough?

dwh
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-02-20 20:58
(Received via mailing list)
Or maybe:

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

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-02-20 21:07
these work great..

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

thanks!
This topic is locked and can not be replied to.