Ensure that we have a slug and owner before attempting to lookup an article (#5079)
This commit is contained in:
parent
145db47a3a
commit
6ba2853168
1 changed files with 1 additions and 1 deletions
|
|
@ -217,7 +217,7 @@ class ArticlesController < ApplicationController
|
|||
|
||||
def set_article
|
||||
owner = User.find_by(username: params[:username]) || Organization.find_by(slug: params[:username])
|
||||
found_article = if params[:slug]
|
||||
found_article = if params[:slug] && owner
|
||||
owner.articles.find_by(slug: params[:slug])
|
||||
else
|
||||
Article.includes(:user).find(params[:id])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue