module Admin::ErEmailsHelper def page_for_email_er(email_er) ann_page = nil pages = Page.where(:module=>'er_email') pages.each do |page| if page.categories.count ==1 if page.categories.include?(email_er.category.id.to_s) ann_page = page end end break if !ann_page.nil? end if ann_page.nil? pages.each do |page| if page.categories.include?(email_er.category.id.to_s) ann_page = page end break if !ann_page.nil? end end ann_page = pages.first if ann_page.nil? request.protocol+(request.host_with_port+'/admin/er_emails/'+email_er.id).gsub('//','/') rescue "/" end end