AWS/S3 and subclassing

A

Adam Groves

Hi all,

How can I make this class return instances of Page instead of instances
of AWS::S3::S3Object when I call Page.find("mydomain", "mypath")?

require "rubygems"
require "aws/s3"

class Page < AWS::S3::S3Object

class << self

alias_method :s3find, :find

def find(domain, path)
connect_to_s3
s3find("#{domain}/#{path}", BUCKET)
end

end
end

I want to be able to define instance methods for updating or deleting a
page.

Grateful for any pointers/suggestions.

Regards

Adam
 
A

Adam Groves

OK. I've realised why this is happening. S3Object.find delegates to
Bucket.find and Bucket.find returns an array of S3Object instances.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,289
Messages
2,571,448
Members
48,126
Latest member
ToneyChun2

Latest Threads

Top