Implemented #show

This commit is contained in:
Absurdon 2017-11-10 10:42:35 +01:00 committed by Absurdon
parent 826614a92c
commit 29d447e97b
2 changed files with 7 additions and 1 deletions

View file

@ -3,9 +3,15 @@ class CustomUrlsController < ApplicationController
end end
def create def create
end end
def show 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 end
def update def update

View file

@ -2,5 +2,5 @@
<%= render partial: "top", locals: { article: @article } %> <%= render partial: "top", locals: { article: @article } %>
<% end %> <% end %>
<%= render partial: "article", object: @article %> <%= render partial: "articles/article", object: @article %>
<%= add_comments @article %> <%= add_comments @article %>