add overloaded parameters support to strong_parameters

Currently strong_parameters do not allow you to overload keys in permitted parameters. I am proposing a change that allows you to accept scalar values, arrays, or a hash of parameters for a particular permitted key, instead of exclusively one of the three.

This is allowed by passing an array with multiple of the same key with different values. For example: user: [:name, {:name => []}, {:name => [:first, :middle]}].

The particular case that this addresses for me is that I have a polymorphic object whose attributes can either be a scalar value or another rails model. This solution allows me to provide one permitted parameters hash to accept all possible types of the polymorphic object without having to condition on the parameters themselves.

You can take a look at the code I have written to solve this problem here: https://github.com/pblesi/rails/commit/1ce634e9990b9b5397b7e5e6aa265ed0410379fc

I appreciate any feedback on the proposed solution.

As a follow up, Using accepts_nested_attributes for, I was able to bypass this problem as I can take either :name of :name_attributes.