Search code examples
rubyruby-on-rails-3rubygemsamazon-simpledb

Why am I getting a NameError out of the box with rails SimpleRecord?


I installed the simple_record gem to use as an ActiveRecord replacement for my rails app. I followed the instructions from http://sites.appoxy.com/simple_record/ and setup an initializer to include the following:

SimpleRecord.establish_connection(AWS_CONFIG['access_key_id'], AWS_CONFIG['secret_access_key'])

When I fire up the rails server (rails s) with I get the following error:

.../.rvm/gems/ruby-1.9.3-p125/gems/simple_record-2.2.0/lib/simple_record/active_sdb.rb:121:in `establish_connection': uninitialized constant SimpleRecord::ActiveSdb::ActiveSdbConnect::Aws (NameError)

It seems that it is trying to find the class name "SimpleRecord::ActiveSdb::ActiveSdbConnect::Aws" but Aws doesn't existing within that namespace. SimpleRecord does require Aws, but it is separate from SimpleRecord. Why would rails be prepending Aws with the SimpleRecord::... namespace?

I'm fairly new to ruby and rails, so maybe my knowledge of name-spacing is lacking and this is an easy fix, but I've been searching for hours and I can't find any answers to my question.

Ruby version: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

Rails version: Rails 3.2.1

SimpleRecord version: 2.2.0


Solution

  • I appreciate the help, but after a couple hours of testing things out, I realized that the issue was a conflict between the simple_record gem and the aws-sdk gem. I was trying to use both separately, but apparently that causes issues.

    So, I disabled the aws-sdk gem and everything works as expected.