質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,4 +60,22 @@
|
|
60
60
|
|
61
61
|
<% end %>
|
62
62
|
|
63
|
+
|
64
|
+
|
65
|
+
・post.rb
|
66
|
+
|
67
|
+
class Post < ApplicationRecord
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
def self.search(search)
|
72
|
+
|
73
|
+
return Post.all unless search
|
74
|
+
|
75
|
+
Post.where(['body LIKE ?', "%#{search}%"])
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
63
81
|
```
|