irb(main):104:0> s = Status.all
=> [#<Status id: 1, card_id: 1, user_id: 1, next: "2001-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>, #<Status id: 2, card_id: 2, user_id: 1, next: "2001-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>, #<Status id: 3, card_id: 3, user_id: 1, next: "2011-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>]
irb(main):105:0> s[2].next < Time.now
=> false
irb(main):106:0> s[1].next < Time.now
=> true
irb(main):107:0> Status.where("next < ?", Time.now)
=> [#<Status id: 1, card_id: 1, user_id: 1, next: "2001-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>, #<Status id: 2, card_id: 2, user_id: 1, next: "2001-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>, #<Status id: 3, card_id: 3, user_id: 1, next: "2011-01-01 00:00:00", level: 1, created_at: nil, updated_at: nil>]
두 개의 개체 만 반환하도록 Status.where 문을 예상합니다. 그것은 where 절이 작동하지 않는 것보다 적은 것 같습니다. 보다 큰 값으로 전환하면 쿼리는 []를 반환합니다. 쿼리가 작동하지 않는 경우날짜가 작동하지 않는 ActiveRecord 조건부 쿼리
다음 마이그레이션
의 날짜로 설정되어있는 이유는이 조건인가? 감사합니다.
Time.now에서 Time.now.utc로 변경하십시오. – Bohdan