I feel this is a very noob question but here goes.
I have a model (gig) with a datetime attribute (date), and an expired boolean attribute (expired).
I want the expired boolean to set to true when the datetime date passes todays date.
In Gig model:
def expired
if self.date.to_date > Date.today
self.update(:expired, true)
end
end
doesn't work. Neither does:
def expired
if self('date < ?', Date.today)
self.update_attribute(:expired, true)
end
end
I feel this should be very simple but I cant find much info on this.