mardi 23 août 2022

How to group user by create date in rails? [duplicate]

How to group user by create date in rails ?

<User... created_at: '2022-03-27 21:32:00' >
<User... created_at: '2022-03-28 19:57:00' >
<User... created_at: '2022-03-28 07:39:00' >
<User... created_at: '2022-03-29 02:23:00' >
<User... created_at: '2022-03-29 18:44:00' >

The result I want is

{ 
'2022-03-27' : [<User... created_at: '2022-03-27 21:32:00' >, <User... created_at: '2022-03-27 18:30:00' >],
'2022-03-28' : [<User... created_at: '2022-03-28 19:57:00' >
<User... created_at: '2022-03-28 07:31:00' >],
'2022-03-29' : [<User... created_at: '2022-03-29 02:23:00' >
<User... created_at: '2022-03-29 18:44:00' >] 
}

Aucun commentaire:

Enregistrer un commentaire