ruby on rails - uninitialized constant UploadsController::Bucket when trying to write general AWS::S3 Upload controller -


i'm trying write general amazon s3 uploader (will used images) rails project. able set environment in console following http://amazon.rubyforge.org/.

i able follow guide in console. however, had trouble when applied rails project. when try access new view, following error:

nameerror in uploadscontroller#new  uninitialized constant uploadscontroller::bucket 

here controller:

class uploadscontroller < applicationcontroller require 'aws/s3'    def new     photo_bucket = bucket.find('photos')     @photos = photo_bucket.objects   end    def create     file = 'black-flowers.jpg'     s3object.store(file, open(file), 'photos')   end end 

in controller, new action contain form upload , list of photos.

my create action save file. haven't figured out how params form passed controller yet, ignore 'black-flowers.jpg' line.

my guess did not establish connection in controller.

how establish connection or fix error?

thanks looking.

bucket not top level constant in case. want aws::s3::bucket constant new, , i'd assume similar s3object.

note may want fog library this.

the fact haven't figured out how params passed in implies may want work through rails tutorials without s3 first.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -