红宝石'2.7.1'/rails 6.0.3.2
我无法使本地活动存储附件正常工作。这是我的设置:
我跑了:
$ rails active_storage:install
$ rake db:migrate
模型架构
create_table "amazon_uploads" do |t|
t.string "status"
t.string "order_csv"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
model:
class AmazonUpload < ApplicationRecord
has_many :amazon_upload_recipients
has_one_attached :order_csv
end
我的存储.yml
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
我的development.rb包含:
config.active_storage.service = :local
然后在我的代码中我这样做:
file = File.open(updated_file_path)
@amazon_upload.order_csv.attach(io: file, filename: "hello", content_type: "application/CSV")
最后一行失败
NameError: uninitialized constant #<Class:0x0000564c2f7e8638>::Analyzable
我能看到的唯一其他参考这个错误的人声称他们有一个类型,但我不认为这是这里的问题