Avoiding some parameters - [Small RoR tip #1]
When you need a list of parameters, but no need some of them, you can do it easily by specifying which params you want to avoid getting, doing the following:
params.except(:symbol, :symbol_2)
Inside the brackets, separated by comas, are the parameter symbols you want to ignore.
For example , the way to ignore controller and action params is:
params.except(:action, :controller)
Enjoy it.
Written by Matías
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#