Simplification

This commit is contained in:
Christoph Haas 2021-02-21 11:12:26 +01:00
parent b6e4bd8a99
commit f68482f850
2 changed files with 3 additions and 9 deletions

View file

@ -18,14 +18,8 @@ class Screenshot < ApplicationRecord
# Calculate how many days ago this screenshot has been uploaded
def age_days
if self.created_at
seconds = Time.now - self.created_at
else
seconds = 0
end
days = (seconds/86400).to_i
days ? "#{days} days ago" : 'today'
def age
time_ago_in_words(self.created_at)
end
# Return caption for full-screen screenshots.