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 %>