Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a title helper

  • Loading branch information...
commit 675a49328d2023d168c74db7ffc8d26002cb8c8a 1 parent b8285cd
@Boo-urns authored
View
12 app/helpers/application_helper.rb
@@ -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
View
2  app/views/layouts/application.html.erb
@@ -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 %>
Please sign in to comment.
Something went wrong with that request. Please try again.