I would like a way to determine if a User record is new or not. Based on where I need to do this in my app, I would like to do this by know if the user was created today or now.
How can I do something like:
if current_user.created_at.today?
Any timezone issues? Maybe it would be better to do, created_at in the last 24 hours?
Thanks
I'd rather use current_user.created_at.to_date == Date.current
, as it is more self explanatory.
To check if the user was created in the last 24 hours, do something like this:
if current_user.created_at > Time.now - 24.hours
#...
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With