Rails Console - Find where created at = certain day

后端 未结 5 597
醉话见心
醉话见心 2021-02-01 03:48

With Ruby on Rails console, is it possible to query the database for all records created on a certain day?

something like

date = \"january 5 2013\"
user         


        
5条回答
  •  一向
    一向 (楼主)
    2021-02-01 04:14

    You can also do it like

    User.where("created_at::date = ?", "january 5 2013".to_date)
    

提交回复
热议问题