From 75b4972682ea79c02f8f26557d444ebd37526299 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 12 Aug 2015 07:28:36 +1000 Subject: [PATCH] posts with no url should return a 404 --- app/models/post.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 00523e187d3..4c53442a1b8 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -340,7 +340,11 @@ class Post < ActiveRecord::Base end def url - Post.url(topic.slug, topic.id, post_number) + if topic + Post.url(topic.slug, topic.id, post_number) + else + "/404" + end end def self.url(slug, topic_id, post_number)