回答編集履歴
1
追記
answer
CHANGED
@@ -13,4 +13,13 @@
|
|
13
13
|
|
14
14
|
@mypostpost.user.id != @current_user.id
|
15
15
|
@pstatus = Post.where.user(status: 2)
|
16
|
-
の部分が理解できていないので、後半の条件where.not(id: @mypost.id, id: @pstatus.idは省いたので、必要なら追加して下さい
|
16
|
+
の部分が理解できていないので、後半の条件where.not(id: @mypost.id, id: @pstatus.idは省いたので、必要なら追加して下さい
|
17
|
+
|
18
|
+
追記
|
19
|
+
`def user
|
20
|
+
return User.find_by(id: self.user_id)
|
21
|
+
end`
|
22
|
+
が気になったので念の為.
|
23
|
+
これ class Post に定義したのではないかと思うのですが、belongs_to :user って定義してますか?
|
24
|
+
それがあればこのmethodは不要です。
|
25
|
+
ないと上の回答がうまく動きません
|