I’ve got a method I’m calling expired? which is simply meant to check to see if its been more than 24 hours since my object has been updated, and if so return true. Here is my method, but although it works, it feels dirty, can anybody think of a better way to achieve my goal?
DAY_IN_SECS = 86400
def expired?
return true unless (Time.now <=> self.updated_at + DAY_IN_SECS) == -1
end
You could use the
active_supportfunctionality, so: