I'm trying to use Hashie
outside of Rails. In my rakefile, I've included require hashie/hash
, but I still get the NoMethodError
. I've tried using require hash
; no luck there either.
This is the line it fails on:
YAML.load(ERB.new(File.read('../prefs.yml')).result)['dev'].symbolize_keys!
When I inspect
the Hash, it looks correct and takes this form: {'key':'value'}
. I want the key to be a symbol, but I don't want to have to switch between Rails 3 and 4, so I installed Hashie
and added it to my Rakefile, but that doesn't seem to solve the problem.
Can anyone tell me why I might be getting this error?
symbolize_keys!
method belongs to activesupport
(github rubygems) and you can't use this it without this gem.
In order to use it add it to your Gemfile(or via bundle add activesupport
)
and explicitly require it in your code
require 'active_support/core_ext/hash/keys'
Or you can write use a polyfill like in this gist