Created
November 10, 2015 09:54
-
-
Save keoghpe/bcc416f9b64208d63e46 to your computer and use it in GitHub Desktop.
IE9 Rails JSON Request Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_action :fix_ie_params, only: [:create] | |
def fix_ie_params | |
unless params.has_key?(:my_missing_param) | |
begin | |
request.body.rewind | |
params.merge! ActiveSupport::JSON.decode(request.body.read) | |
rescue Exception=>e | |
Rails.logger.warn "[#{self.class}] #{e.message}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment