This rails sql query:
Flight.where(arrival_date_time: "2017-04-02 23:29:43".to_datetime)
Does not work even though I have this in my database:
#<Flight id: 1, departed_from_id: 1, arriving_to_id: 3, departure_date_time: "2017-04-02 16:29:43", arrival_date_time: "2017-04-02 23:29:43", created_at: "2017-04-02 13:29:43", updated_at: "2017-04-02 13:29:43">
It returns with this:
Flight Load (0.2ms) SELECT "flights".* FROM "flights" WHERE "flights"."arrival_date_time" = ? [["arrival_date_time", 2017-04-02 23:29:43 UTC]]
=> #<ActiveRecord::Relation []>
I have also tried
Flight.find_by(arrival_date_time: "2017-04-02 23:29:43".to_datetime)
and
Flight.where("arrival_date_time = ? ", "2017-04-02 23:29:43".to_datetime)
All 3 queries return nil.
PS: arrival_date_time
is of class ActiveSupport::TimeWithZone