lib/ajax/helpers/request_helper.rb in ajax-1.0.8 vs lib/ajax/helpers/request_helper.rb in ajax-1.1.0
- old
+ new
@@ -22,11 +22,11 @@
# <tt>value</tt> any value that con be converted to JSON
#
# All Hash and Array values are deep-merged.
# Hash keys are converted to Strings.
def set_header(object, key, value)
- headers = object.is_a?(::ActionController::Response) ? object.headers : object
+ headers = object.is_a?(Hash) ? object : object.headers # ::ActionController::Response
key = key.to_s
info = case headers["Ajax-Info"]
when String
JSON.parse(headers["Ajax-Info"]) rescue {}
@@ -59,10 +59,10 @@
# in <tt>object</tt>.
#
# <tt>object</tt> can be a Hash or instance of <tt>ActionController::Request</tt>
# <tt>key</tt> Symbol or String hash key, converted to String
def get_header(object, key)
- headers = object.is_a?(::ActionController::Request) ? object.headers : object
+ headers = object.is_a?(Hash) ? object : object.headers # ::ActionController::Request
key = key.to_s
info = case headers["Ajax-Info"]
when String
JSON.parse(headers["Ajax-Info"]) rescue {}
\ No newline at end of file