From 658ffe34a1a15222799512871879287c84ea8bac Mon Sep 17 00:00:00 2001 From: manson Date: Fri, 2 May 2014 18:54:08 +0800 Subject: [PATCH] Fix backend index page --- app/helpers/admin/announcements_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers/admin/announcements_helper.rb b/app/helpers/admin/announcements_helper.rb index a1dc7ce..1c6171e 100644 --- a/app/helpers/admin/announcements_helper.rb +++ b/app/helpers/admin/announcements_helper.rb @@ -1,5 +1,7 @@ module Admin::AnnouncementsHelper def page_for_bulletin(bulletin) - request.protocol+(request.host_with_port+Page.where(:categories.in=>[bulletin.category.id.to_s]).first.url+'/'+bulletin.to_param).gsub('//','/') + page = Page.where(:categories.in=>[bulletin.category.id.to_s]).first + page = Page.where(:module=>'announcement').first if page.nil? + request.protocol+(request.host_with_port+page.url+'/'+bulletin.to_param).gsub('//','/') rescue "/" end end