From 66633443de1c127841eb8ac149d0e3f9095c2f73 Mon Sep 17 00:00:00 2001 From: Fu Matthew Date: Wed, 13 Mar 2013 17:53:11 +0800 Subject: [PATCH] add conditions for making multi cates and tags more stable --- app/controllers/admin/page_parts_controller.rb | 4 ++-- app/controllers/admin/pages_controller.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 1fbee0a64..b7a036909 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -65,11 +65,11 @@ class Admin::PagePartsController < OrbitBackendController params[:page_part][:module_app] = nil end - if params[:page_part][:tag].include?("nil") + if params[:page_part][:tag].nil? || params[:page_part][:tag].include?("nil") params[:page_part][:tag] = [] end - if params[:page_part][:category].include?("nil") + if params[:page_part][:category].nil? || params[:page_part][:category].include?("nil") params[:page_part][:category] = [] end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index c5d68d098..6b9ad9cc3 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -79,11 +79,11 @@ helper Admin::PagePartsHelper params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field] params[:page][:frontend_field_type] = nil - if params[:page][:tag].include?("nil") + if params[:page][:tag].nil? || params[:page][:tag].include?("nil") params[:page][:tag] = [] end - if params[:page][:category].include?("nil") + if params[:page][:category].nil? || params[:page][:category].include?("nil") params[:page][:category] = [] end