OpenSSL::Cipher::CipherError Rails 5.2

A.J*_*A.J 4 ruby ssl ruby-on-rails rails-activestorage

我查看了有关此错误的所有可能解决方案,但没有任何解决方案。

每次我尝试上传图像时,都会收到该错误。

config/application.rb我已require 'active_storage/engine'取消注释。

config/environments/development.rb我已经config.active_storage.service = :local设置。

我跑rails active_storage:installrails db:migrate

模型的名字是 user_test

class UserTest < ApplicationRecord
  has_one_attached :image
end
Run Code Online (Sandbox Code Playgroud)

我在 app/controllers/user_tests_controller.rb 中有这个

def user_test_params
  params.require(:user_test).permit(:title, :caption, :image)
end 
Run Code Online (Sandbox Code Playgroud)

**配置/存储.yml*

test:
  service: Disk
  root: <%= Rails.root.join("tmp/storage") %>

local:
  service: Disk
  root: <%= Rails.root.join("storage") %>
Run Code Online (Sandbox Code Playgroud)

我真的不知道为什么它不起作用。

编辑:

Completed 500 Internal Server Error in 111ms (ActiveRecord: 43.1ms)



    OpenSSL::Cipher::CipherError - :
      (erb):12:in `<main>'
      app/controllers/user_tests_controller.rb:27:in `create'

    Started POST "/__better_errors/52f33e5e173d5e27/variables" for 127.0.0.1 at 2019-01-10 14:02:17 -0600
Run Code Online (Sandbox Code Playgroud)

小智 5

我很抱歉我的英语不好。

我的解决方案是删除 storage.yml 中的所有代码注释

在此处输入图片说明

终于工作了。