Active Storage Rails的Blob错误5.2

我刚刚升级了5.1.4。 应用程序到5.2,我正在尝试将Paperclip替换为ActiveStorage。 在尝试使用图像更新现有记录时,我收到以下错误:

无法自动加载常量ActiveStorage :: Blob :: Analyzable,预期/Users/Simon/.rvm/gems/ruby-2.4.0/gems/activestorage-5.2.0/app/models/active_storage/blob/analyzable.rb来定义它

在我的模型中:

has_one_attached :pic 

在我的控制器中:

  def update respond_to do |format| if @gin.update(gin_params) format.html { redirect_to @gin, notice: 'Gin was successfully updated.' } format.json { render :show, status: :ok, location: @gin } else format.html { render :edit } format.json { render json: @gin.errors, status: :unprocessable_entity } end end end 

  def gin_params params.require(:gin).permit(:name, :text, :snippet, :pic, :slug, :abv, distillery_attributes: [:id, :name], botanical_ids: []) end 

在storage.yml中:

  amazon: service: S3 access_key_id:  secret_access_key:  region: xx-xxxx-x bucket: xxxxxxx 

我通过rails credentials:edit设置访问密钥rails credentials:edit

在development.rb中:

  config.active_storage.service = :amazon 

在我看来:

  

我一直在阅读http://edgeapi.rubyonrails.org/classes/ActiveStorage/Blob/Analyzable.html,但这对我来说并没有多大意义。

错误让我在app/models/active_storage/blob/analyzable.rb查找文件,但我在我的应用程序中看不到它?

我错过了什么?

解决

虽然我已经有了gem 'aws-sdk-s3', '~>1'我没有require: false

我有完全相同的错误。 对我而言,这是因为缺少AWS S3的凭据( 凭证中缺少凭证。