Dynamoid
Dynamoid copied to clipboard
adding any index results crash
this class works fine.
class Article
include Dynamoid::Document
table :name => :articles, :key => :id, :read_capacity => 1, :write_capacity => 1
field :id, :integer
field :uri
field :place, :integer
end
but whenever i add INDEX into Article i get error:
`const_defined?': wrong constant name Aws-sdk (NameError)
class Article
include Dynamoid::Document
table :name => :articles, :key => :id, :read_capacity => 1, :write_capacity => 1
field :id, :integer
field :uri
field :place, :integer
index :place
end
When you configure Dynamoid, you need to set the adapter configuration option to 'aws_sdk' rather than the default 'aws-sdk' option, which is incorrect.
This pulls in the correct adapter for the ruby dynamo sdk. You get this error when you include an index because this exercises a piece of code that necessitates accessing dynamo. You should get this same error if you were to run Article.new even in the first example.
Where to set the configuration? Any sample code link?
Just add this wherever you do the initialization for your site or in spec_helper.rb if you just want to run tests.
Dynamoid.configure do |config| config.adapter = 'aws_sdk' end