Quantcast
Channel: Rails 3 - Ideal way to set title of pages - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Rails 3 - Ideal way to set title of pages

$
0
0

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

app/views/layouts/application.html:

<head><title><%= render_title %></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?


Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles





Latest Images