Skip to content

Commit 54bd795

Browse files
committed
Handle positional vs. kwargs for get
In Rails 5.0 positional args for HTTP request methods were deprecated so conditionally override get to do the transition from kwargs to the older positional format.
1 parent fe96863 commit 54bd795

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/caching_test.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def test_action_cache_with_symbol_cache_path
426426
assert_response :success
427427
assert fragment_exist?('controller')
428428

429-
get :symbol_cache_path, id: 1
429+
get :symbol_cache_path, params: { id: 1 }
430430
assert_response :success
431431
assert fragment_exist?('controller-1')
432432
end
@@ -720,4 +720,15 @@ def draw(&block)
720720
@routes.draw(&block)
721721
@controller.extend(@routes.url_helpers)
722722
end
723+
724+
if ActionPack::VERSION::STRING < '5.0'
725+
def get(action, options = {})
726+
format = options.slice(:format)
727+
params = options[:params] || {}
728+
session = options[:session] || {}
729+
flash = options[:flash] || {}
730+
731+
super(action, params.merge(format), session, flash)
732+
end
733+
end
723734
end

0 commit comments

Comments
 (0)