]> source.dussan.org Git - redmine.git/commitdiff
Refactor: pull #query_statement_invalid up to ApplicationController.
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 29 Apr 2010 15:19:19 +0000 (15:19 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 29 Apr 2010 15:19:19 +0000 (15:19 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3696 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/application_controller.rb
app/controllers/gantts_controller.rb
app/controllers/issues_controller.rb

index 5e2ab7ed9c71680859a7d08c756005f6df7f46bb..66886ea00610e644912db8cf7dd8c56da920c0bf 100644 (file)
@@ -329,4 +329,13 @@ class ApplicationController < ActionController::Base
   def render_attachment_warning_if_needed(obj)
     flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present?
   end
+
+  # Rescues an invalid query statement. Just in case...
+  def query_statement_invalid(exception)
+    logger.error "Query::StatementInvalid: #{exception.message}" if logger
+    session.delete(:query)
+    sort_clear if respond_to?(:sort_clear)
+    render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
+  end
+
 end
index 91312e8ae281e5d0e113374197d45bcbebe61577..3933577c5327af234bc0e0c7b71b61867f47b52b 100644 (file)
@@ -7,6 +7,8 @@ class GanttsController < ApplicationController
   helper :projects
   helper :queries
   include QueriesHelper
+  helper :sort
+  include SortHelper
   include Redmine::Export::PDF
   
   def show
@@ -42,15 +44,6 @@ class GanttsController < ApplicationController
 
   private
 
-  # Rescues an invalid query statement. Just in case...
-  # TODO: Refactor, move to ApplicationController with IssuesController
-  def query_statement_invalid(exception)
-    logger.error "Query::StatementInvalid: #{exception.message}" if logger
-    session.delete(:query)
-    sort_clear
-    render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
-  end
-
   # TODO: Refactor, duplicates IssuesController
   def find_optional_project
     @project = Project.find(params[:project_id]) unless params[:project_id].blank?
index 3eb7f18a22b8501e006475043743c40a973c0fe1..95218e02258ba5472ca82c73838980a7effaf444 100644 (file)
@@ -453,14 +453,6 @@ private
     render_404
   end
 
-  # Rescues an invalid query statement. Just in case...
-  def query_statement_invalid(exception)
-    logger.error "Query::StatementInvalid: #{exception.message}" if logger
-    session.delete(:query)
-    sort_clear
-    render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
-  end
-
   # Used by #edit and #update to set some common instance variables
   # from the params
   # TODO: Refactor, not everything in here is needed by #edit