回答編集履歴
2
追記
test
CHANGED
@@ -57,3 +57,27 @@
|
|
57
57
|
end
|
58
58
|
|
59
59
|
```
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
追記
|
64
|
+
|
65
|
+
pagy は使ったことがないのですが
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
elsif params[:keyword]
|
70
|
+
|
71
|
+
keywords = params[:keyword].split(/[[:blank:]]+/).select(&:present?)
|
72
|
+
|
73
|
+
relation = like_(keywords.shift)
|
74
|
+
|
75
|
+
keywords.each{ |keyword| relation.or(like_keyword) }
|
76
|
+
|
77
|
+
pagy, offices = pagy relation
|
78
|
+
|
79
|
+
else
|
80
|
+
|
81
|
+
```
|
82
|
+
|
83
|
+
かな
|
1
修正
test
CHANGED
@@ -19,3 +19,41 @@
|
|
19
19
|
```
|
20
20
|
|
21
21
|
としましょう
|
22
|
+
|
23
|
+
訂正
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
def search_office_from_keyword(keywords)
|
28
|
+
|
29
|
+
offices = []
|
30
|
+
|
31
|
+
keywords.each do |keyword|
|
32
|
+
|
33
|
+
offices += Office.where(。。。)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
offices
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
でした。
|
44
|
+
|
45
|
+
もしくは
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
def search_office_from_keyword(keywords)
|
50
|
+
|
51
|
+
keywords.each_with_object([]) do |keyword,offices|
|
52
|
+
|
53
|
+
offices += Office.where(。。。)
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
```
|