Reputation: 110950
I'm working to create an email alert that only sends out if X.created_at is from yesterday or older.
I don't want to alerts going out a day.
Ideas? Thanks
Upvotes: 0
Views: 201
Reputation:
Use ruby's Date.yesterday.to_time.to_i
like
send_email if ob.created_at > Date.yesterday.to_time.to_i
Upvotes: 0
Reputation: 316
Anything before midnight last night:
ob.created_at.to_i < Time.now.beginning_of_day.to_i
Anything before 24 hours ago right now:
ob.created_at.to_i < Time.now.to_i - 86400
Upvotes: 2