Skip to content

Commit

Permalink
Make strong_parameters example simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran committed Sep 30, 2012
1 parent 955a72c commit 0677d99
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions guides/source/security.md
Expand Up @@ -499,10 +499,11 @@ attributes.


```ruby ```ruby
def user_params def user_params
filters = [:name] if current_user.admin?
filters << :admin if current_user.try(:admin?) params.require(:user).permit(:name, :admin)

else
params.require(:user).permit(*filters) params.require(:user).permit(:name)
end
end end
``` ```


Expand Down

0 comments on commit 0677d99

Please sign in to comment.