Skip to content

Commit

Permalink
Alter the merge order on Hanami::Action::Params#_params
Browse files Browse the repository at this point in the history
The `_router_params` where taking precedence over
`@result.output` leading to the problem reported on #226

Fixes #226
  • Loading branch information
Marcello Rocha committed May 16, 2017
1 parent 7564849 commit 3ec98fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/hanami/action/params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def to_h

# @api private
def _params
@result.output.merge(_router_params)
_router_params.merge(@result.output)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
response = @app.request('PATCH', '/painters/23', params: { painter: { first_name: 'Gustav', last_name: 'Klimt' } })

response.status.must_equal 200
response.body.must_equal %({:painter=>{:first_name=>"Gustav", :last_name=>"Klimt"}, :id=>"23"})
response.body.must_equal %({:id=>"23", :painter=>{:first_name=>"Gustav", :last_name=>"Klimt"}})
end
end
end
Expand Down

0 comments on commit 3ec98fe

Please sign in to comment.