don't show 404 page for channels that don't exist

This commit is contained in:
Lee Lawlor 2015-03-13 11:19:48 -04:00
parent 87c2cf1b53
commit 19ae3343cb
2 changed files with 10 additions and 2 deletions

View File

@ -154,7 +154,13 @@ class ChannelsController < ApplicationController
end end
def show 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 @title = @channel.name
@domain = domain @domain = domain
@ -609,3 +615,4 @@ class ChannelsController < ApplicationController
end end
end end

View File

@ -2,6 +2,7 @@
<ol class="breadcrumb"> <ol class="breadcrumb">
<%# g1199258 %> <%# g1199258 %>
<li><%= link_to t(:channels), auth_channels_path %></li> <li><%= link_to t(:channels), auth_channels_path %></li>
<li class="active"><%= @channel.name %></li> <li class="active"><%= @channel.public? ? @channel.name : "Channel #{@channel.id}" %></li>
</ol> </ol>
</div> </div>