Open luxx opened 12 years ago
I too had the error with the bad constant "aws-sdk". It turns out my aws.yml file -- the file I added to include the AWS key and secret access key and dynamo-db-endpoint -- had not been checked in and included with the push.
I keep getting the same flavor of errors. Standalone, inside of rails, using AWS sdk < v2 and >= v2. Does anyone have a working example of rails 4 working with Dynamoid, or even a standalone project?
.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/dynamoid-0.7.1/lib/dynamoid/adapter.rb:22:in `const_defined?': wrong constant name Aws-sdk (NameError)
I may be missing something, but there is a problem with the default configuration: the default value in lib/dynamoid/config.rb sets Dynamoid::Config.adapter to be 'aws-sdk', but this causes a problem with how the reconnect! method is currently implemented:
require "dynamoid/adapter/aws-sdk" will fail, the file name is actually aws_sdk. Also on the 2nd line Dynamoid::Config.adapter.camelcase gives 'Aws-sdk' which I think is supposed to be Dynamoid::Adapter::AwsSdk.
I found this method to be too complex and monkey patched it for my application to something more simple:
For a more general solution I would say, if you want to use the adapter in reconnect, leave the responsibility of the caller to require the file. I did not test this, but perhaps something like might do the trick:
Even if you do not push the responsibility of requiring it to the caller, it should work with the defaults.