Permalink
Browse files

Use named routes

  • Loading branch information...
avdgaag committed Mar 24, 2015
1 parent e9342ff commit d25b3815d59fe2a0b8c84558ac1408d3c0dd7f3c
Showing with 4 additions and 4 deletions.
  1. +2 −2 apps/web/config/routes.rb
  2. +1 −1 apps/web/templates/application.html.erb
  3. +1 −1 apps/web/templates/home/index.html.erb
@@ -5,5 +5,5 @@
#
# This route will look for `Web::Controllers::Home::Index` action in `apps/web/controllers/home/index.rb`.
# Please, uncomment the following line to have a working example.
get '/', to: 'home#index'
get '/articles/:id', to: 'articles#show'
get '/', to: 'home#index', as: 'root'
get '/articles/:id', to: 'articles#show', as: 'article'
@@ -6,7 +6,7 @@
</head>
<body>
<div id="page">
<h1><a href="/" rel="home">Lotus example blog</a></h1>
<h1><a href="<%= routes.root_path %>" rel="home">Lotus example blog</a></h1>
<%= yield %>
</div>
</body>
@@ -3,7 +3,7 @@
<% if articles.any? %>
<% articles.each do |article| %>
<div class="article">
<h3 class="article__title"><a href="/articles/<%= article.id %>" rel="permalink"><%= article.title %></a></h3>
<h3 class="article__title"><a href="<%= routes.article_path(article.id) %>" rel="permalink"><%= article.title %></a></h3>
<div clas="article__body">
<%= article.body %>
</div>

0 comments on commit d25b381

Please sign in to comment.