質問編集履歴
1
一部間違った情報を書いていました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -286,13 +286,23 @@
|
|
286
286
|
|
287
287
|
```ugblogrb
|
288
288
|
|
289
|
-
class Ug
|
289
|
+
class Ugblog < ApplicationRecord
|
290
|
-
|
290
|
+
|
291
|
-
|
291
|
+
has_many :ugsama
|
292
|
+
|
292
|
-
|
293
|
+
mount_uploader :img, ImgUploader
|
293
|
-
|
294
|
-
|
294
|
+
|
295
|
+
|
296
|
+
|
295
|
-
validates :
|
297
|
+
validates :title, :subtitle, :Text, :img, presence: {message:'は、必須事項です。'}
|
298
|
+
|
299
|
+
def self.search(search)
|
300
|
+
|
301
|
+
return Ugblog.all unless search
|
302
|
+
|
303
|
+
Ugblog.where(['content LIKE ?', "%#{search}%"])
|
304
|
+
|
305
|
+
end
|
296
306
|
|
297
307
|
end
|
298
308
|
|