OpenSSL :: Cipher :: CipherError Rails 5.2

时间:2019-01-10 16:04:20

标签: ruby-on-rails ruby ssl 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

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

def user_test_params
  params.require(:user_test).permit(:title, :caption, :image)
end 

** config / storage.yml *

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

local:
  service: Disk
  root: <%= Rails.root.join("storage") %>

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

编辑:

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

1 个答案:

答案 0 :(得分:2)

对不起,我的英语不好。

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

enter image description here

终于可以了。

相关问题