Skip to content

Commit

Permalink
Scope parameters according to Rails version
Browse files Browse the repository at this point in the history
Rails 5 has deprecated the keywords arguments for #permit. This patch
scopes the request params according to the ActionPack version.

Fixes #867.  Supercedes #917 with passing tests.

Thank you to @freesteph for helpin' out!
  • Loading branch information
mygulamali committed Sep 23, 2016
1 parent d1e9a41 commit c64468e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/shoulda/matchers/action_controller/permit_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ def matches?(controller)
parameters_double_registry.register

Doublespeak.with_doubles_activated do
context.__send__(verb, action, request_params)
scoped = ::ActionPack::VERSION::MAJOR >= 5
params = scoped ? { params: request_params } : request_params

context.__send__(verb, action, params)
end

unpermitted_parameter_names.empty?
Expand Down

0 comments on commit c64468e

Please sign in to comment.