Open dmerand opened 8 years ago
There's an unstated dependency on http://apidock.com/rails/ActiveSupport/HashWithIndifferentAccess
which is causing this issue. If you add in the activesupport
library to your project or otherwise define HashWithIndifferentAccess
, this error will go away
Thanks, that fixes it indeed! For anybody else with this problem, the require line is:
require 'active_support/all'
I've got same trouble and wondering why don't this add require 'active_support/all'
into here?
Any reason?
I'll address that. Is there any reason to not depend on active_support explicitly?
active_support is a pretty expensive dependency to bring in to a project that doesn't already have it loaded. I wonder if we'd be better off finding an alternate way to make it so we can do @record[:foo]
and @record['foo']
produce the same response. That said, easiest solution is to depend explicitly on active_support
Handling @record[:foo]
and @record['foo']
is pretty easy. I'd just store data keyed by the string k
, a map from to_key(k)
to k
and lookup the key if the argument to @record[]
is a symbol. I think it'll actually be better, because you'd only be exposed to naming collisions created by to_key
when you use an ambiguous symbol.
@record.fields[:foo]
and @record.fields['foo']
is a bit more complicated as we'd need an equivalent replacement for HashWithIndifferentAccess
. I'm leaning towards checking if it exists and returning one if it does. If you don't have active_support, it'd just work until you try to use @record.fields with a symbol.
Hi,
I've been working on getting this gem to work for some time, and I'm stuck. I'm wondering if the issue is my setup or the gem.
Here's my setup code:
...pretty much straight from the README. When I run that code, I get this error:
As you can see, I'm using rbenv. I've run this same code on Ruby 1.9.1, 2.2.4, and 2.3.0 and I can't get it to do anything but give me the error you see above. Am I missing something? Or this this a bug?
I downloaded the gem source to my machine and ran the tests, which ran just fine.