I cannot get Shrine to work no matter what I do and I am using the simplest of setups to start with.
db/schema.rb
create_table "plaqueorders", force: :cascade do |t|
...
t.text "image_data"
...
initializers/shrine.rb
require 'shrine'
require 'shrine/storage/file_system'
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/cache'),
store: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/store'),
}
Shrine.plugin :activerecord
Shrine.plugin :cached_attachment_data # for forms
uploaders/image_uploader.rb
class ShrineImageUploader < Shrine
end
models/plaqueorder.rb
class Plaqueorder < ApplicationRecord
belongs_to :user
validates :plaque_type, presence: true
include ShrineImageUploader[:image]
end