I'm working to do the following in my Rails App:
if record.updated_at > 15.minutes.ago do some stuff end
Meaning... If the record.updated_at was over 15 minutes ago, do some stuff...
This doesn't seem to be working. Ideas?
You want:
if record.updated_at < 15.minutes.ago
That's "less-than" as in "before".
Greater than or less than should work, depending on which you mean. 15.minutes.ago returns a time object that should compare properly with record.updated_at. When you say it "doesn't seem to be working", could you be more specific? Also, if you could show a few more lines of code it may help. For example, if you're doing this all on one line then you're missing some syntax.
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