回答編集履歴
1
コード修正
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`
|
1
|
+
自分ならこんな感じですかね。余談ですが `image_for` はかなり汎用的な名前なのであまりいいヘルパメソッド名ではないように思います。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -6,17 +6,11 @@
|
|
6
6
|
|
7
7
|
module UsersHelper
|
8
8
|
|
9
|
-
|
9
|
+
def user_profile_img(user)
|
10
10
|
|
11
|
-
|
11
|
+
path = user.try(:image) ? "/user_images/#{user.image}" : "kikirara.png"
|
12
12
|
|
13
|
-
image_tag "/user_images/#{user.image}", class: "profile_img"
|
14
|
-
|
15
|
-
else
|
16
|
-
|
17
|
-
|
13
|
+
image_tag path, class: "profile_img"
|
18
|
-
|
19
|
-
end
|
20
14
|
|
21
15
|
end
|
22
16
|
|