From d3f0a10187966f0c40fb2338570d6d0063bf0958 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 17 Jun 2013 15:26:43 +0800 Subject: [PATCH] fix default setting for partial category selection error,due to API changing. --- app/controllers/default_widget_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index 1f946165..ef3d77bf 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -20,12 +20,12 @@ class DefaultWidgetController< OrbitWidgetController if params["category_id"].blank? #has tag no cate result = @ori_class_name.constantize.where(:tagged_ids.in => params["tag_id"]) else #has tag and cate - result = eval("#{@ori_class_name}.where(:#{get_category_field_name(@ori_class_name)}.in=>params['category_id'], :tagged_ids.in => params['tag_id'])") + result = eval("#{@ori_class_name}.where(:#{get_category_field_name}.in=>params['category_id'], :tagged_ids.in => params['tag_id'])") end elsif params["category_id"].blank? #no tag no cate result = eval(@default_widget["query"]) else #no tag has cate - result = eval("#{@ori_class_name}.where(:#{get_category_field_name(@ori_class_name)}.in=>params['category_id'])") + result = eval("#{@ori_class_name}.where(:#{get_category_field_name}.in=>params['category_id'])") end result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate) end @@ -90,7 +90,7 @@ class DefaultWidgetController< OrbitWidgetController end end - def get_category_field_name() + def get_category_field_name @ori_class_name = @ori_class_name.constantize @ori_class_name.fields.each_key do |key| return key if key.include?('category_id')