From 19ae3343cb259c4d87a60878ddf122453a9ca880 Mon Sep 17 00:00:00 2001 From: Lee Lawlor Date: Fri, 13 Mar 2015 11:19:48 -0400 Subject: [PATCH] don't show 404 page for channels that don't exist --- app/controllers/channels_controller.rb | 9 ++++++++- app/views/channels/_breadcrumb.html.erb | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 8ecc70f..65f65de 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -154,7 +154,13 @@ class ChannelsController < ApplicationController end def show - @channel = Channel.find(params[:id]) if params[:id] + @channel = Channel.find_by_id(params[:id]) + + # show the public show page if no channel found + if @channel.blank? + @channel = Channel.new(public_flag: false, name: "Channel #{params[:id]}", id: params[:id]) + render "public_show" and return + end @title = @channel.name @domain = domain @@ -609,3 +615,4 @@ class ChannelsController < ApplicationController end end + diff --git a/app/views/channels/_breadcrumb.html.erb b/app/views/channels/_breadcrumb.html.erb index c0ada4d..8bdd7a9 100644 --- a/app/views/channels/_breadcrumb.html.erb +++ b/app/views/channels/_breadcrumb.html.erb @@ -2,6 +2,7 @@ +