]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Merge remote-tracking branch 'upstream/pull/2670'
[rails.git] / app / controllers / application_controller.rb
index bee5e8169a4709d05f5d36ead2c6924a03f2db6a..a2211ea69b4fde7a7ba1c81e696b102762a4e2cd 100644 (file)
@@ -10,7 +10,9 @@ class ApplicationController < ActionController::Base
   around_action :better_errors_allow_inline, :if => proc { Rails.env.development? }
 
   attr_accessor :current_user
+
   helper_method :current_user
+  helper_method :preferred_langauges
 
   private
 
@@ -185,6 +187,8 @@ class ApplicationController < ActionController::Base
 
   def api_call_handle_error
     yield
+  rescue ActionController::UnknownFormat
+    head :not_acceptable
   rescue ActiveRecord::RecordNotFound => e
     head :not_found
   rescue LibXML::XML::Error, ArgumentError => e
@@ -231,7 +235,7 @@ class ApplicationController < ActionController::Base
     e = e.cause
 
     if e.is_a?(Timeout::Error) ||
-       (e.is_a?(ActiveRecord::StatementInvalid) && e.message =~ /execution expired/)
+       (e.is_a?(ActiveRecord::StatementInvalid) && e.message.include?("execution expired"))
       render :action => "timeout"
     else
       raise