This error in our Rails application drove me crazy. The error was like this:
undefined method xxxxxx' for #<Hash:0x000000001234>
The problem was that i was calling a method like this: a_method(var: var)
And the method definition was like def a_method(var: var)
which resulted in something called variable shadowing and caused clash between variable passed in the method and local variable being defined.
The fix was to change method definition to def a_method(var:)
Still learning Ruby.