In a controller's update action, I have:
entry.update_attributes(params[:entry])
There are some keys in params[:entry]
that either correspond to non-accessible fields, or no field at all. If I don't have control over the values in params[:entry]
, how can I filter it so that only accessible fields for the relevant model remain in it, presumably by accessing a list of the whitelisted attributes for the model? I know how to exclude/include keys from a hash, but I don't want to manually define the keys to include/exclude, because then I'd be duplicating the whitelist when it's already defined in the model.
I'm using Rails 3.2.13.