I looked at every possible solution regarding this error but nothing solved it.
Every time I try to upload an image, I receive that error.
In config/application.rb
I have require 'active_storage/engine'
uncommented.
In config/environments/development.rb
I have config.active_storage.service = :local
set up.
I ran rails active_storage:install
and rails db:migrate
.
The name of the model is user_test
class UserTest < ApplicationRecord
has_one_attached :image
end
I have this in 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") %>
I am really clueless as to why it isn't working.
Edit:
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
I'm sorry for my bad english.
My solution was delete all code comments in storage.yml
And finally works.