ruby on rails - "missing required :bucket option" for Paperclip/S3 -


in rails app i'm letting users upload image when create "release", , should upload directly s3. i'm getting following error in both development , production.

edit: should note error happens when trying upload release edit page on form submit.

argumenterror in releasescontroller#update  missing required :bucket option rails.root: /users/jasondemeuse/pressed 

i've done before no issues using carrierwave, can't figure out i'm doing wrong i'm using paperclip. of fixes i've seen on , elsewhere heroku issues, i'm getting same problem on development , none of fixes have helped.

here's relevant code ("..." indicates not relevant snippets):

development.rb

appname::application.configure  ...    config.paperclip_defaults = {     :storage => :s3,     :s3_protocol => 'http',     :s3_credentials => {       :bucket => env['aws_bucket'],       :access_key_id => env['aws_access_key_id'],       :secret_access_key => env['aws_secret_access_key']     }   } end 

production.rb

appname::application.configure  ...    config.paperclip_defaults = {     :storage => :s3,     :s3_protocol => 'http',     :s3_credentials => {       :bucket => env['aws_bucket'],       :access_key_id => env['aws_access_key_id'],       :secret_access_key => env['aws_secret_access_key']     }   } end 

release.rb

class release < activerecord::base   attr_accessible ... :banner     belongs_to :user     has_attached_file :banner, styles: {     thumb: '100x100>',     square: '200x200#',     medium: '300x300>',     spread: '1200x200'   }    has_many :banners, :dependent => :destroy   accepts_nested_attributes_for :banners, :allow_destroy => true   end 

show.html.erb

<%= image_tag @release.banner.url(:medium) %> <%= @release.banner.url %>  // have both of these in see if work, since upload isn't working it's giving me missing.png 

_form.html.erb

<%= f.label "add banner?" %><br /> <%= f.file_field :banner %> 

heroku config (have same in .bash_profile development)

aws_access_key_id:            xxxxxxxxxxxxxxxx aws_bucket:                   appname aws_secret_access_key:        xxxxxxxxxxxxxxxxxxxxxxxxxxx 

edit: here's relevant part of controller too

  def update     @release = release.find(params[:id])       respond_to |format|       if @release.update_attributes(params[:release])         format.html { redirect_to [@user,@release], notice: 'release updated.' }         format.json { head :no_content }       else         format.html { render action: "edit" }         format.json { render json: @release.errors, status: :unprocessable_entity }       end     end   end 

i know should extremely simple , i'm sure forgot obvious, i've been going on this walkthrough fixes i've found , nothing seems work. there rake task or bundle forgot run or something?

thank in advance!

edit 2: below answers helped me out lot, , switching fog gem fixed things me. in case others having these same issues, having problem making 1 confusing me. if you're having heroku issues , paperclip::papercliperror (item model missing required attr_accessor 'image_file_name'):, make sure run heroku rake db:migrate restart heroku heroku restart. loaded schema , wrongly assumed wouldn't need that.

a answer above can found here.

i think that's because :bucket should option passed paperclip not s3.
fixed config

  config.paperclip_defaults = {     :storage => :s3,     :s3_protocol => 'http',     :bucket => env['aws_bucket'],     :s3_credentials => {       :access_key_id => env['aws_access_key_id'],       :secret_access_key => env['aws_secret_access_key']     }   } 

and paperclip::storage::s3 doc seems confirm that, being poorly written/formatted.

edit:

in 1 of projects use paperclip fog gem , works well

paperclip::attachment.default_options.merge!(   :storage => :fog,   :fog_credentials => {     :provider => 'aws',     :aws_access_key_id => env['s3_access_key_id'],     :aws_secret_access_key => env['s3_secret_access_key'],     :region => 'eu-west-1' # in case need   },   :fog_directory => env['s3_bucket'], # 1 of needed don't remember   :bucket => env['s3_bucket'] ) 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -