Skip to content
Browse files

Update workaround for "Outside the Scope of Strong Parameters"

The previous example of how to permit a hash of unknown keys used .tap, but had the side effect of logging an "Unpermitted parameters" message despite being a successful workaround. The proposed workaround is ever so slightly better, imo, because it won't result in an "Unpermitted parameters" message being logged.
  • Loading branch information...
1 parent f230dbf commit 1dc9e1ce7f7e51491ce186b7da2965951d73307d @serracorwin serracorwin committed Oct 22, 2013
Showing with 1 addition and 3 deletions.
  1. +1 −3 guides/source/action_controller_overview.md
View
4 guides/source/action_controller_overview.md
@@ -328,9 +328,7 @@ the job done:
```ruby
def product_params
- params.require(:product).permit(:name).tap do |whitelisted|
- whitelisted[:data] = params[:product][:data]
- end
+ params.require(:product).permit(:name, { data: params[:product][:data].keys })
end
```

0 comments on commit 1dc9e1c

Please sign in to comment.
Something went wrong with that request. Please try again.