aws/s3 Requires Rails 1.2?

Howdy,

Quick question about the aws/s3 library from Marcel... Does that require Rails 1.2?

It works great for me when running against the 1.2RC1 gems but if I tell my app to require 1.1.6, then I get this error when starting the server:

#<TypeError: ACL is not a class>

I didn't see it in the docs but I was curious if 1.2 was required. If not, any idea what's going on?

Thanks, Hunter

That sounds like dependency loading weirdness. If you just plopped the aws code into your plugins directory you might need to explicitly require it in your environment.rb. If you are using it from gems, then something is likely funky. aws/s3's implementation is completely orthogonal to Rails. The only software that it depends on having a certain version of is Ruby (1.8.2 or greater) and the libraries that it has as depencencies.

Having said that, I bet we can get Rails 1.16 to load it up correctly. Just let me know how you are hooking it into the app. Via the plugins directory or via rubygems. Where are you referencing it in your app? Required in environment.rb or just const missing magic?

marcel

Hey Marcel,

I am using aws via gems, not as a plug-in.

I am requiring it in my environment.rb file (and that's where it is choking - if I comment that out, all is well). I am adding the following to environment.rb:

require 'aws/s3' include AWS::S3

I then go on to use it in several places in the app.

It works great with 1.2, by the way. It's just 1.1.6 that chokes.

Cheers, Hunter

Ah, that's what it is. I think ActionWebService has an ACL module, or maybe someting in ActionMailer does, so since that is already loaded, when you include AWS::S3 it sees the ACL class and isn't happy.

You can instead do

include AWS

And then you should be fine, though you'll have to change your code to say S3::Bucket or whatever.

marcel

Marcel,

That appears to have worked like a charm.

Thanks, Hunter

Hey Marcel,

I seem to see this collision often, such as in the under-development
attachment_fu plug in under Rails 1.2.

Is changing the include the best fix or would it make sense to use a
class name that doesn't collide?

Thanks again for the work on the gem. I use it every day.

Hunter