Permalink
Browse files

Added a title helper

  • Loading branch information...
1 parent b8285cd commit 675a49328d2023d168c74db7ffc8d26002cb8c8a @Boo-urns committed Mar 27, 2011
Showing with 13 additions and 1 deletion.
  1. +12 −0 app/helpers/application_helper.rb
  2. +1 −1 app/views/layouts/application.html.erb
@@ -1,2 +1,14 @@
module ApplicationHelper
+
+ # return a title on per-page basis
+ def title
+ base_title = "Railstut"
+
+ if @title.nil?
+ base_title
+ else
+ "#{base_title} | #{@title}"
+ end
+ end
+
end
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Railstut | <%= @title %></title>
+ <title><%= title %></title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>

0 comments on commit 675a493

Please sign in to comment.