Uninitialized Constant Using New S3 Library

I am trying to use the new S3 library (thanks Marcel!) but I am
getting an Uninitialized Constant message:

Service.buckets
NameError: uninitialized constant Service
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/
lib/active_support/dependencies.rb:100:in
const_missing_not_from_s3_library' from /opt/local/lib/ruby/gems/1.8/gems/aws-s3-0.1.1/lib/aws/ s3/extensions.rb:119:inconst_missing’
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/
lib/active_support/dependencies.rb:131:in `const_missing’
from (irb):2

I am calling the following in my environment.rb file:

require ‘aws/s3’
AWS::S3::Base.establish_connection!(:access_key_id =>
MY_ID_HERE, :secret_access_key => MY_KEY_HERE)

and then I fired up the console and tried the above and boom…

I also tried not putting the connection call in environment.rb and
instead into a controller. Same deal.

I recently upgraded to the new gem:

aws-s3 (0.1.1, 0.1.0)
Client library for Amazon’s Simple Storage Service’s REST API

Any ideas what I am doing wrong? I can run the command line client
included in the gem without difficulty.

Thanks a ton,
Hunter

Hunter H. wrote:

I am trying to use the new S3 library (thanks Marcel!) but I am
getting an Uninitialized Constant message:

Service.buckets
NameError: uninitialized constant Service
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/
lib/active_support/dependencies.rb:100:in
const_missing_not_from_s3_library' from /opt/local/lib/ruby/gems/1.8/gems/aws-s3-0.1.1/lib/aws/ s3/extensions.rb:119:inconst_missing’
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/
lib/active_support/dependencies.rb:131:in `const_missing’
from (irb):2

I am calling the following in my environment.rb file:

require ‘aws/s3’
AWS::S3::Base.establish_connection!(:access_key_id =>
MY_ID_HERE, :secret_access_key => MY_KEY_HERE)

and then I fired up the console and tried the above and boom…

I also tried not putting the connection call in environment.rb and
instead into a controller. Same deal.

I recently upgraded to the new gem:

aws-s3 (0.1.1, 0.1.0)
Client library for Amazon’s Simple Storage Service’s REST API

Any ideas what I am doing wrong? I can run the command line client
included in the gem without difficulty.

Thanks a ton,
Hunter

That is because Service is not accessible globally.

add the below line
include AWS::S3

or access Service through

AWS::S3.Service

that should work.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs