質問編集履歴
2
storage.yml追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -159,6 +159,46 @@
|
|
159
159
|
|
160
160
|
end
|
161
161
|
```
|
162
|
+
```ruby
|
163
|
+
|
164
|
+
storage.yml
|
165
|
+
|
166
|
+
test:
|
167
|
+
service: Disk
|
168
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
169
|
+
|
170
|
+
local:
|
171
|
+
service: Disk
|
172
|
+
root: <%= Rails.root.join("storage") %>
|
173
|
+
|
174
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
175
|
+
# amazon:
|
176
|
+
# service: S3
|
177
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
178
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
179
|
+
# region: us-east-1
|
180
|
+
# bucket: your_own_bucket
|
181
|
+
|
182
|
+
# Remember not to checkin your GCS keyfile to a repository
|
183
|
+
# google:
|
184
|
+
# service: GCS
|
185
|
+
# project: your_project
|
186
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
187
|
+
# bucket: your_own_bucket
|
188
|
+
|
189
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
190
|
+
# microsoft:
|
191
|
+
# service: AzureStorage
|
192
|
+
# storage_account_name: your_account_name
|
193
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
194
|
+
# container: your_container_name
|
195
|
+
|
196
|
+
# mirror:
|
197
|
+
# service: Mirror
|
198
|
+
# primary: local
|
199
|
+
# mirrors: [ amazon, google, microsoft ]
|
200
|
+
|
201
|
+
```
|
162
202
|
|
163
203
|
### 試したこと
|
164
204
|
|
1
モデル追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -134,6 +134,32 @@
|
|
134
134
|
end
|
135
135
|
```
|
136
136
|
|
137
|
+
```ruby
|
138
|
+
app>models>design.rb
|
139
|
+
|
140
|
+
class Design < ApplicationRecord
|
141
|
+
belongs_to :user
|
142
|
+
has_one_attached :image
|
143
|
+
has_many :post_tag_relations, dependent: :destroy
|
144
|
+
has_many :tags, through: :post_tag_relations
|
145
|
+
|
146
|
+
validates :title, presence: true
|
147
|
+
validates :file_name, presence: true
|
148
|
+
validates :image, presence: true
|
149
|
+
|
150
|
+
def self.search(search)
|
151
|
+
if search != ""
|
152
|
+
Design.where('title LIKE(?)', "%#{search}%")
|
153
|
+
else
|
154
|
+
Design.all
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
end
|
161
|
+
```
|
162
|
+
|
137
163
|
### 試したこと
|
138
164
|
|
139
165
|
webで調べ、<% if design.image.attached? %> を追記しましたが表示されません。
|