updated_at not today?

How can you verify that it has not been updated today?

if @post.updated_ad "is not today"
  @post.counter = @post.counter + 1
  @post.save
end

Check if the current date is equal to that?

–Rob

The first question is what do you mean by today? Note in particular
that your date may not be the same as mine if we are in different
timezones.

Colin

Colin Law wrote in post #1151057:

The first question is what do you mean by today? Note in particular
that your date may not be the same as mine if we are in different
timezones.

Same year, same month and same date. And I think that all of my visitors
are in the same time zone and it is not so important, about the same
day...

This is basic ruby…
–Rob

if @post.updated_at.strftime("%d-%m-%Y") !=
Time.now.strftime("%d-%m-%Y")

Or is there better way?

Read up on the Date class. You can compare dates directly, and you have the whole range of < = > operators to work on them.

Walter

Those give you the dates in UTC, which may not be the same as the
local timezone date.

Colin