2014-04-25 2 views
0

나는 클립 보석을 통해 이미지를 localhost로 업로드 할 수 있습니다하지만 난 Heroku가에이 작업을 수행 할 때 오류레일 4 응용 프로그램 아마존 S3

Completed 500 Internal Server Error in 801ms 
ArgumentError (missing required :bucket option): 
app/controllers/listings_controller.rb:29:in `create' 
ArgumentError (missing required :bucket option): 
app/controllers/listings_controller.rb:29:in `create' 

내가 모든 설정되었는지 보여줍니다에게 Heroku의 설정을 실행을 얻을 통해 업로드 오류를 받고 - 양동이, id & 액세스 키 및보고 아마존 s3에서 - 이미지는 과거에 저장되었지만 이제 오류가 발생합니다.

명부 컨트롤러

class ListingsController < ApplicationController 
    before_action :set_listing, only: [:show, :edit, :update, :destroy] 

    # GET /listings 
    # GET /listings.json 
    def index 
    @listings = Listing.all 
    end 

    # GET /listings/1 
    # GET /listings/1.json 
    def show 
    end 

    # GET /listings/new 
    def new 
    @listing = Listing.new 
    end 

    # GET /listings/1/edit 
    def edit 
    end 

    # POST /listings 
    # POST /listings.json 
    def create 
    @listing = Listing.new(listing_params) 

     if @listing.save 
     redirect_to @listing, notice: 'Listing was successfully created.' 
     else 
     render action: 'new' 
     end 
    end 


    # PATCH/PUT /listings/1 
    # PATCH/PUT /listings/1.json 
    def update 

     if @listing.update(listing_params) 
     redirect_to @listing, notice: 'Listing was successfully updated.' 
     else 
     render action: 'edit' 
     end 
    end 

    # DELETE /listings/1 
    # DELETE /listings/1.json 
    def destroy 
    @listing.destroy 
     redirect_to listings_url 
    end 

    private 
    # Use callbacks to share common setup or constraints between actions. 
    def set_listing 
     @listing = Listing.find(params[:id]) 
    end 

    # Never trust parameters from the scary internet, only allow the white list through. 
    def listing_params 
     params.require(:listing).permit(:name, :description, :image) 
    end 
end 

listing.rb

class Listing < ActiveRecord::Base 

    has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" } 
    validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ 

    validates :image, presence: true 
    validates :description, presence: true 
    validates :name, presence: true 

end 

config.production

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'] 
    } 
} 

답변