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.
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..

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!
Denis H. (Guest)
on 2009-02-20 21:55
(Received via mailing list)
"show_names".humanize => "Show names"

close enough?

dwh
Maurício L. (Guest)
on 2009-02-20 21: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)
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...

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