回答編集履歴

2

idにしてみる

2018/04/18 11:36

投稿

raccy
raccy

スコア21735

test CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ```Ruby
6
6
 
7
- User.where.not(user_id: current_user.id).order("RAND()").first
7
+ User.where.not(id: current_user.id).order("RAND()").first
8
8
 
9
9
  ```
10
+
11
+
12
+
13
+ Userのカラムが"id"でなければ、適当に変えてみて下さい。

1

Rubyだよ

2018/04/18 11:36

投稿

raccy
raccy

スコア21735

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- ```
5
+ ```Ruby
6
6
 
7
7
  User.where.not(user_id: current_user.id).order("RAND()").first
8
8