From 5b289bc1d2f08fb164db35b1218f2d1633634947 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 3 Jan 2013 12:16:02 +0800 Subject: [PATCH] Fix old tags --- app/controllers/admin/tags_controller.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb index cd5e00c9..8e8a4e6b 100644 --- a/app/controllers/admin/tags_controller.rb +++ b/app/controllers/admin/tags_controller.rb @@ -46,12 +46,16 @@ class Admin::TagsController < OrbitBackendController protected - def set_module_app - @module_app ||= ModuleApp.first(:conditions => {:key => @app_title.underscore}) rescue nil - end - def get_tags @tags = (@module_app ? @module_app.tags : Tag.all) end + + def setup_vars + @app_key = request.env['HTTP_REFERER'].split('/')[4] + if @app_key + @app_key.gsub!(/[?].*/, '') + @module_app = ModuleApp.first(conditions: {:key => @app_key}) + end + end end