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...
serracorwin committed Oct 22, 2013
1 parent f230dbf commit 1dc9e1ce7f7e51491ce186b7da2965951d73307d
Showing with 1 addition and 3 deletions.
  1. +1 −3 guides/source/
@@ -328,9 +328,7 @@ the job done:
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 })

0 comments on commit 1dc9e1c

Please sign in to comment.