Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding any index results crash #182

Open
maxbugaenko opened this issue Nov 11, 2014 · 3 comments
Open

adding any index results crash #182

maxbugaenko opened this issue Nov 11, 2014 · 3 comments

Comments

@maxbugaenko
Copy link

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
@ngordon17
Copy link

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.

@hlms
Copy link

hlms commented Mar 20, 2015

Where to set the configuration? Any sample code link?

@ngordon17
Copy 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants