How to remove nested keys from a hash list in Rails
I am now trying for some hours to remove a nested hash key of a hash list. I saw many solution non-nested hashs wich looks like this: sample_hash = {"key1" => "value1", "key2" => "value2"} sample_hash.except("key1") This results in: {"key2"=>"value2"} But if I try to use the except method on a hash with nested key then it doesn't work. Here my code: nested_hash = {"key1"=>"value1", "key2"=>{ "nested_key1"=>"nestedvalue1", "nested_key2"=>"nestedvalue2" } } nested_hash.except("nested_key2") The except() method returns the nested_hash without any changes. I have looked for a solution how I can