diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 690d94a7..3d1b8d3a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -64,13 +64,13 @@ class PagesController < ApplicationController module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) if !params[:category_id].blank? && !params[:tag_id].blank? @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]}) - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) unless @item + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item elsif !params[:category_id].blank? - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) elsif !params[:tag_id].blank? - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :tag => params[:tag_id]}) + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => '', :tag => params[:tag_id]}) end - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) unless @item + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => '', :tag => ''}) unless @item #TODO 需要做 error handler 處理沒有新增該模組頁面導致錯誤的可能性 end