app/controllers/uploader/attachments_controller.rb in rails-uploader-0.1.3 vs app/controllers/uploader/attachments_controller.rb in rails-uploader-0.1.4
- old
+ new
@@ -1,6 +1,5 @@
-# encoding: utf-8
module Uploader
class AttachmentsController < ActionController::Metal
include AbstractController::Callbacks
before_filter :find_klass
@@ -41,11 +40,13 @@
render_json(record.errors, 422)
end
end
def render_json(hash_or_object, status = 200)
+ ctype = self.env["HTTP_USER_AGENT"].include?('Android') ? 'text/plain' : "application/json"
+
self.status = status
- self.content_type = "application/json"
+ self.content_type = ctype
self.response_body = hash_or_object.to_json(:root => false)
end
end
end