Skip to content

Instantly share code, notes, and snippets.

@mcconkiee
Created December 5, 2013 16:08
Show Gist options
  • Save mcconkiee/7808139 to your computer and use it in GitHub Desktop.
Save mcconkiee/7808139 to your computer and use it in GitHub Desktop.
S3able intall and config
#add to Gemfile
gem 's3able', path: '/Users/ericmcconkie/Desktop/s3uploadengine/s3able'
gem 'aws-sdk'
#mount to routes
mount S3able::Engine => '/images', :as => 's3image' #you can see all uploads at http://localhost:3000/images
get 'products/:id/image'=>'s3able/s3images#new', :s3imageable=>"Product" #a place to upload an image and attach to your model
#config
rake s3able:s3config secret="{{AWS_SECRET}}" key="{{AWS_KEY}}" bucket="{{aws_bucket}}"
#associate your model
class Product < ActiveRecord::Base
has_many :s3images, :as => :s3imageable, :dependent => :destroy ,:class_name => 'S3able::S3image'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment