teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

fix error

2020/09/15 08:35

投稿

tomtdhzz
tomtdhzz

スコア10

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  ``` ruby
2
+ @users = User.where(
2
- @user = User.where(prefecture_id: @current_user.prefecture_id)
3
+ prefecture_id: @current_user.prefecture_id,
3
- .where('users.birthday between ? and ?',
4
- @current_user.birthday - 3.years, @current_user.birthday + 3.years)
4
+ birthday: (current_user.birthday - 3.year .. current_user.birthday + 3.year
5
- .order("RANDOM()").limit(10)
5
+ ).order("RANDOM()").limit(10)
6
6
  ```