When I finished working on next feature I made sure everything works on
Then I pushed to
Heroku where my app …failed.
I have found an error which was quite surprising:
NoMethodError - undefined method `to_h' for :Array:
Why didn’t I get this error on
I digged for a moment and I found out that the
#to_h method for
Array is only available in Ruby version 2.1 or higher.
On my machine the default ruby version was
Apparently Heroku used an older version.
The solution was quite obvious.
Adding ruby version to Gemfile solved the problem:
ruby '2.1.5' # or any higher version than 2.1
That’s one of the reasons why to add ruby version to your Gemfile.