回答編集履歴
2
テキスト修正
test
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
あくまで「自分ならこうするかも」という一例ですが、
|
6
|
+
|
5
|
-
|
7
|
+
@a_matsuda さん作の [ActiveDecorator](https://github.com/amatsuda/active_decorator) を使って、
|
6
8
|
|
7
9
|
`User` のデコレータ `module UserDecorator` を作り、そこに、
|
8
10
|
|
1
テキスト修正
test
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
あくまで「自分ならこうするかも」という一例ですが、@a_matsuda さんの
|
5
|
+
あくまで「自分ならこうするかも」という一例ですが、@a_matsuda さん作の [ActiveDecorator](https://github.com/amatsuda/active_decorator) を使って、
|
6
6
|
|
7
|
-
|
7
|
+
`User` のデコレータ `module UserDecorator` を作り、そこに、
|
8
|
-
|
9
|
-
そこに、
|
10
8
|
|
11
9
|
|
12
10
|
|
13
11
|
```ruby
|
14
12
|
|
15
|
-
def unread_
|
13
|
+
def unread_notifications_count_string(zero='0')
|
16
14
|
|
17
15
|
count = notifications.where(read: false).count
|
18
16
|
|
@@ -36,7 +34,7 @@
|
|
36
34
|
|
37
35
|
|
38
36
|
|
39
|
-
とするか、コントローラのほうで
|
37
|
+
とするか、コントローラのアクションのほうで、
|
40
38
|
|
41
39
|
|
42
40
|
|
@@ -60,6 +58,8 @@
|
|
60
58
|
|
61
59
|
とするか、このどちらかを考えます。
|
62
60
|
|
61
|
+
|
62
|
+
|
63
63
|
どちらがいいかは、この箇所以外で、このような場合どのように解決しているかの
|
64
64
|
|
65
65
|
プロジェクトの流儀というか慣習があると思うので、それに合わせます。
|