Ignoring extra keys in a hash passed in to create
- by denniss
Does rails provide a way to ignore extra keys that are passed in to create. Supposed User has two attributes, first_name and last_name. When I do
User.create({ :first_name => "first", :last_name => "last", :age => 10})
that line gives me an UknonwnAttributeError. Well, that makes sense, it happens cause age is not one of the attributes.
But is there a way to just ignore key-value pair that is not one of the attributes for User?