Browse files

Update workaround for "Outside the Scope of Strong Parameters" [ci skip]

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 cb176b0 commit c881052486af1c6164a352b636cbc3bd038f6f2b @serracorwin serracorwin committed with fxn Oct 22, 2013
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].try(:keys))

0 comments on commit c881052

Please sign in to comment.