2016-05-25 5 views
1

Googleのクラウドへの画像アップロードを実装しようとしていますキャリバーウェーブの宝石を使用して私のレール4.2アプリからのストレージ。画像をアップロードするたびにエラーhostname "project-name.appspot.com.storage.googleapis.com" does not match the server certificate (OpenSSL::SSL::SSLError)が表示されます。ホスト名「project-name.appspot.com.storage.googleapis.com」がサーバー証明書(OpenSSL :: SSL :: SSLError)と一致しません - 霧とワーキングを使用

私はここから何をする必要があるか分かりません。

carrierwave.rbファイル

CarrierWave.configure do |config| 
    config.fog_credentials = { 
    provider:       'Google', 
    google_storage_access_key_id:  'key', 
    google_storage_secret_access_key: 'secret key' 
    } 
    config.fog_directory = 'project-name.appspot.com' 
end 

アップローダ/ check_item_value_image_uploader.rb

class CheckItemValueImageUploader < CarrierWave::Uploader::Base 

    # Include RMagick or MiniMagick support: 
    # include CarrierWave::RMagick 
    # include CarrierWave::MiniMagick 

    # Choose what kind of storage to use for this uploader: 
    #storage :file 
    storage :fog 

    # Override the directory where uploaded files will be stored. 
    # This is a sensible default for uploaders that are meant to be mounted: 
    def store_dir 
    "check-item-value-images/#{model.id}" 
    end 

    # Add a white list of extensions which are allowed to be uploaded. 
    # For images you might use something like this: 
    def extension_white_list 
    %w(jpg jpeg gif png) 
    end 

end 

関連宝石

gem 'gcloud' 
gem "fog" 
gem 'google-api-client', '~> 0.8.6' 
gem "mime-types" 

check_category_item_valueモデル

私は、画像をアップロードするファイル名の文字列を保存していないでしょう(画像のアップロードのためのcarrierwaveを実装する前に210の

check_category_item_value更新方法

if @check_category_item_value.save 
    flash[:success] = "Successfully updated" 
    redirect_to category_items_edit_path(@guide, @category, @category_item) 
else 
    render 'category_items/edit' 
end 

編集フォーム

<%= form_for(@check_category_item_value) do |f| %> 
    <%= f.file_field :value, :value => item_key.value, accept: "image/jpeg, image/jpg, image/gif, image/png" %> 
    <%= f.submit "Submit" %><hr> 
<% end %> 

フォームがうまく働きました)。今度は、イメージアップロードのためにcarrierwaveを実装しようとしましたが、私は上記のエラーを受け取ります。

私が今持っているものを手に入れるために、Googleのクラウドプラットフォームでcarrierwave docsthis post、およびthis videoを使用。このエラーの原因は何ですか?

+0

を有する唯一のあなたではないようです。 – 13aal

+0

これはまたあなたに役立つかもしれませんhttps://github.com/carrierwaveuploader/carrierwave/issues/667 – 13aal

+1

@ 13aal私はその名前にドットのない別のバケットを作りました。これを答えとして投稿してください。ありがとう – Rob

答えて

1

搬送波を使用している間は、バケットに点(.)があります。

ドットを付けずに別のバケットを作成すると機能します。

は、ここではいくつかのexamplesだ、あなたはSSLが有効になっている宝石を伝える必要があり、このproblem

関連する問題