Rails 3 - Ideal way to set title of pages

Posted by akfalcon on Stack Overflow See other posts from Stack Overflow or by akfalcon
Published on 2010-06-17T07:35:28Z Indexed on 2010/06/17 7:43 UTC
Read the original article Hit count: 132

Filed under:

Whats the proper way to set the page title in rails 3. Currently I'm doing the following:

app/views/layouts/application.html .... <%= render_title %> <%= csrf_meta_tag %> ....

app/helpers/application_helper.rb ... def render_title return @title if defined?(@title) "Generic Page Title" end ...

app/controllers/some_controller.rb ... def show @title = "some custom page title" ... end ...

Is there another/better way of doing the above?

© Stack Overflow or respective owner

Related posts about ruby-on-rails3