From 29d447e97b0da4dc9a1f2a41fe3b908fc7574961 Mon Sep 17 00:00:00 2001 From: Absurdon Date: Fri, 10 Nov 2017 10:42:35 +0100 Subject: [PATCH] Implemented #show --- app/controllers/custom_urls_controller.rb | 6 ++++++ app/views/articles/show.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/custom_urls_controller.rb b/app/controllers/custom_urls_controller.rb index 49d9a07..b6b1a8d 100644 --- a/app/controllers/custom_urls_controller.rb +++ b/app/controllers/custom_urls_controller.rb @@ -3,9 +3,15 @@ class CustomUrlsController < ApplicationController end def create + end def show + custom_url = CustomUrl.find_by_name(params[:name]) + @article = custom_url.article + raise AccessError unless @article.can_show? cuser + @article.read_by! cuser if cuser + render 'articles/show' end def update diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 30aac8d..56d3a1d 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -2,5 +2,5 @@ <%= render partial: "top", locals: { article: @article } %> <% end %> -<%= render partial: "article", object: @article %> +<%= render partial: "articles/article", object: @article %> <%= add_comments @article %>