From 4ef7fc861f76742e4a4a13f49e9c4305fc4e5080 Mon Sep 17 00:00:00 2001 From: Shyam Visamsetty Date: Sat, 10 Jan 2015 22:00:38 +0530 Subject: [PATCH] Fix translate request issue which is failing on bad request --- app/assets/javascripts/recurring_select_dialog.js.coffee.erb | 2 +- app/middleware/recurring_select_middleware.rb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/recurring_select_dialog.js.coffee.erb b/app/assets/javascripts/recurring_select_dialog.js.coffee.erb index 6cf340c3..7172c313 100644 --- a/app/assets/javascripts/recurring_select_dialog.js.coffee.erb +++ b/app/assets/javascripts/recurring_select_dialog.js.coffee.erb @@ -169,7 +169,7 @@ window.RecurringSelectDialog = $.ajax url: "<%= Rails.application.config.action_controller.relative_url_root %>/recurring_select/translate/#{$.fn.recurring_select.texts["locale_iso_code"]}", type: "POST", - data: @current_rule.hash + data: JSON.stringify(@current_rule.hash) success: @summaryFetchSuccess summaryFetchSuccess: (data) => diff --git a/app/middleware/recurring_select_middleware.rb b/app/middleware/recurring_select_middleware.rb index 5ddc450e..c17280f5 100644 --- a/app/middleware/recurring_select_middleware.rb +++ b/app/middleware/recurring_select_middleware.rb @@ -10,9 +10,7 @@ def call(env) regexp = /^\/recurring_select\/translate\/(.*)/ if env["PATH_INFO"] =~ regexp I18n.locale = env["PATH_INFO"].scan(regexp).first.first - request = Rack::Request.new(env) - params = request.params - params.symbolize_keys! + params = env["action_dispatch.request.request_parameters"] if params and params[:rule_type] rule = RecurringSelect.dirty_hash_to_rule(params)