質問編集履歴
1
追記依頼のschema.rbの内容を追記した。
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,6 +19,8 @@
|
|
19
19
|

|
20
20
|
|
21
21
|
エラーが出る箇所
|
22
|
+
|
23
|
+
Controllers/PapersController.rb
|
22
24
|
```
|
23
25
|
class PapersController < ApplicationController
|
24
26
|
︙
|
@@ -38,8 +40,8 @@
|
|
38
40
|
end
|
39
41
|
```
|
40
42
|
|
41
|
-
|
43
|
+
models/paper.rb
|
42
|
-
```
|
44
|
+
```Ruby:models/paper.rb
|
43
45
|
class Paper < ApplicationRecord
|
44
46
|
has_one_attached :pdf
|
45
47
|
|
@@ -55,8 +57,13 @@
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
```
|
60
|
+
config/environments/development.rb
|
58
61
|
```
|
62
|
+
Rails.application.configure do
|
63
|
+
︙
|
59
64
|
config.active_storage.service = :amazon
|
65
|
+
︙
|
66
|
+
end
|
60
67
|
```
|
61
68
|
|
62
69
|
ダイレクトアップロードは使っていません。
|
@@ -66,12 +73,64 @@
|
|
66
73
|
### やってみたこと
|
67
74
|
|
68
75
|
ActiveStorageのアップロードは非同期らしいことはわかり、それが原因かと思い、
|
69
|
-
config/development.rbに
|
76
|
+
config/environments/development.rbに
|
77
|
+
```Ruby:config/environments/development.rb
|
78
|
+
Rails.application.configure do
|
70
|
-
|
79
|
+
︙
|
71
80
|
config.active_job.queue_adapter = :inline
|
81
|
+
︙
|
82
|
+
end
|
72
83
|
```
|
73
84
|
を追記してみたのですが、エラーが出ます。
|
74
85
|
|
75
86
|
なにか他にありそうな原因だけでも思い当たる箇所がある方はいませんでしょうか?
|
76
87
|
また回避策的な解決方法でもなにかご教授いただけないでしょうか?
|
77
|
-
よろしくお願いいたします。
|
88
|
+
よろしくお願いいたします。
|
89
|
+
|
90
|
+
### 追記コード
|
91
|
+
db/schema.rb
|
92
|
+
```Ruby:db/schema.rb
|
93
|
+
ActiveRecord::Schema.define(version: 2021_09_27_090222) do
|
94
|
+
create_table "active_storage_attachments", charset: "utf8", force: :cascade do |t|
|
95
|
+
t.string "name", null: false
|
96
|
+
t.string "record_type", null: false
|
97
|
+
t.bigint "record_id", null: false
|
98
|
+
t.bigint "blob_id", null: false
|
99
|
+
t.datetime "created_at", null: false
|
100
|
+
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
101
|
+
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
102
|
+
end
|
103
|
+
|
104
|
+
create_table "active_storage_blobs", charset: "utf8", force: :cascade do |t|
|
105
|
+
t.string "key", null: false
|
106
|
+
t.string "filename", null: false
|
107
|
+
t.string "content_type"
|
108
|
+
t.text "metadata"
|
109
|
+
t.bigint "byte_size", null: false
|
110
|
+
t.string "checksum", null: false
|
111
|
+
t.datetime "created_at", null: false
|
112
|
+
t.string "service_name", null: false
|
113
|
+
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
114
|
+
end
|
115
|
+
|
116
|
+
create_table "active_storage_variant_records", charset: "utf8", force: :cascade do |t|
|
117
|
+
t.bigint "blob_id", null: false
|
118
|
+
t.string "variation_digest", null: false
|
119
|
+
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
120
|
+
end
|
121
|
+
︙
|
122
|
+
︙
|
123
|
+
create_table "papers", id: :string, charset: "utf8", force: :cascade do |t|
|
124
|
+
t.string "name"
|
125
|
+
t.text "keyword"
|
126
|
+
t.datetime "created_at", null: false
|
127
|
+
t.datetime "updated_at", null: false
|
128
|
+
end
|
129
|
+
︙
|
130
|
+
︙
|
131
|
+
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
132
|
+
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
133
|
+
︙
|
134
|
+
︙
|
135
|
+
end
|
136
|
+
```
|