fixed member categories all problem

This commit is contained in:
Harry Bomrah 2014-12-19 16:33:23 +08:00
parent e21ad257ff
commit 2402f953f0
1 changed files with 13 additions and 4 deletions

View File

@ -75,10 +75,19 @@ class PagesController < ApplicationController
end
params[:url] = page.url
categories = []
page.categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
categories << c
if page.module == "member"
page.categories.each do |c|
category = Role.find(c) rescue nil
if !category.nil? && !category.disabled
categories << c
end
end
else
page.categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
categories << c
end
end
end
categories = ["all"] if categories.blank?