heroku - How to setup paperclip to upload multiple files to s3 -


i'm pretty new rails , i'm trying setup rails application use paperclip multiple image uploads s3.

what i've done:

environments/production.rb config.paperclip_defaults = {   :storage => :s3,   :s3_credentials => {     :bucket => env['s3_bucket_name'],     :access_key_id => env['aws_access_key_id'],     :secret_access_key => env['aws_secret_access_key']   } } 

in model:

has_attached_file :avatar, styles: { large: '640x480#', medium: '300x300>', thumb: '100x100#'  }  # validate attached image image/jpg, image/png, etc validates_attachment_content_type :avatar, :content_type => /\aimage\/.*\z/ 

i'm not sure other information include here. went through guide on heroku setup. when try upload image don't error or in heroku logs. doesn't show items in s3 bucket.

here's log heroku:

2014-03-10t02:33:32.836518+00:00 app[web.1]: started patch "/projects/1-casper-fire-ems-station-no-3" 97.112.188.114 @ 2014-03-10 02:33:32     +0000 2014-03-10t02:33:32.840016+00:00 app[web.1]: processing projectscontroller#update html 2014-03-10t02:33:32.840221+00:00 app[web.1]:   parameters: {"utf8"=>"✓", "authenticity_token"=>"inrdcj8ekzppoykwovwnqtuetcc8prymcwtag8sejxi=",     "project"=>{"name"=>"no. 3", "category_id"=>"1", "type_id"=>"1", "description"=>"2\" snow retention system.", "size"=>"14,800 sf", "city"=>    "chyenne", "state"=>"wy", "year"=>"2010", "assets_attributes"=>{"0"=>{"asset"=>#<actiondispatch::http::uploadedfile:0x007f5a36dc9370 @tempfile=#<    tempfile:/tmp/rackmultipart20140310-13-npdcmq>, @original_filename="181740-metalroofretrofit.jpg", @content_type="image/jpeg", @headers="content-    disposition: form-data; name=\"project[assets_attributes][0][asset]\"; filename=\"181740-metalroofretrofit.jpg\"\r\ncontent-type: image/jpeg\r\n">    , "caption"=>"first image", "homescreen_picture"=>"1"}, "1"=>{"caption"=>"", "homescreen_picture"=>"0"}, "2"=>{"caption"=>"",     "homescreen_picture"=>"0"}, "3"=>{"caption"=>"", "homescreen_picture"=>"0"}, "4"=>{"capti 2014-03-10t02:33:32.840221+00:00 app[web.1]: on"=>"", "homescreen_picture"=>"0"}}}, "commit"=>"update project", "id"=>"1-casper-fire-ems-station-    no-3"} 2014-03-10t02:33:32.887302+00:00 app[web.1]: redirected http://slow-prison-8111.herokuapp.com/ 2014-03-10t02:33:32.887413+00:00 app[web.1]: completed 302 found in 47ms (activerecord: 11.2ms) 2014-03-10t02:33:33.022342+00:00 app[web.1]: processing staticcontroller#index html 2014-03-10t02:33:33.020299+00:00 app[web.1]: started "/" 97.112.188.114 @ 2014-03-10 02:33:33 +0000 2014-03-10t02:33:33.028706+00:00 app[web.1]:   rendered static/index.html.erb within layouts/application (0.9ms) 2014-03-10t02:33:33.034121+00:00 app[web.1]: completed 200 ok in 12ms (views: 4.9ms | activerecord: 4.6ms) 2014-03-10t02:33:33.519801+00:00 app[web.1]: started "/assets/brlogoclear.png" 97.112.188.114 @ 2014-03-10 02:33:33 +0000 2014-03-10t02:33:34.887395+00:00 heroku[router]: at=info method=head path=/ host=slow-prison-8111.herokuapp.com request_id=d9290026-84f1-459a-8ee2    -a841aa9e196a fwd="50.31.164.139" dyno=web.1 connect=2ms service=18ms status=200 bytes=873 2014-03-10t02:33:34.884045+00:00 app[web.1]: completed 200 ok in 9ms (views: 4.3ms | activerecord: 2.3ms) 2014-03-10t02:33:34.873392+00:00 app[web.1]: started head "/" 50.31.164.139 @ 2014-03-10 02:33:34 +0000 2014-03-10t02:33:34.875333+00:00 app[web.1]: processing staticcontroller#index */* 2014-03-10t02:33:34.880412+00:00 app[web.1]:   rendered static/index.html.erb within layouts/application (0.2ms) 

if need provide more info please let me know. i've been struggling issue days , don't know what's going on.

i got working! changed model following , started working again! must have edited @ point , put wrong name after has_attached_file.

class asset < activerecord::base   belongs_to :project    has_attached_file :asset,   styles: {     large: '640x480#',     medium: '300x300>',     thumb: '100x100#'   },   :path => ':class/:id/:style.:extension'  end 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -