Skip to content
Browse files

Make strong_parameters example simpler

  • Loading branch information...
1 parent 955a72c commit 0677d9904a1c4b88594e491967a6646346659d19 @guilleiguaran guilleiguaran committed Sep 30, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 guides/source/security.md
View
9 guides/source/security.md
@@ -499,10 +499,11 @@ attributes.
```ruby
def user_params
- filters = [:name]
- filters << :admin if current_user.try(:admin?)
-
- params.require(:user).permit(*filters)
+ if current_user.admin?
+ params.require(:user).permit(:name, :admin)
+ else
+ params.require(:user).permit(:name)
+ end
end
```

0 comments on commit 0677d99

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