Class: Shot

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
CommonScopes
Defined in:
app/models/shot.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommonScopes

included

Class Method Details

.send_remindersObject

send email reminder for shots about to expire


31
32
33
34
35
36
# File 'app/models/shot.rb', line 31

def self.send_reminders
  @shots = Shot.where('expires BETWEEN ? AND ?', 7.day.from_now.beginning_of_day, 7.day.from_now.end_of_day)
  @shots.each do |shot|
    ShotMailer.reminder_email(shot).deliver
  end
end

Instance Method Details

#formatted_expires_dateObject


11
12
13
# File 'app/models/shot.rb', line 11

def formatted_expires_date
  self.expires.blank? ? '' : self.expires.strftime('%a, %b %e at %l:%M')
end

#formatted_last_administered_dateObject


15
16
17
# File 'app/models/shot.rb', line 15

def formatted_last_administered_date
  self.last_administered.blank? ? '' : self.last_administered.strftime('%a, %b %e at %l:%M')
end