Slide 20
Slide 20 text
class Logfile < ApplicationRecord
extend _ActiveRecord_Relation_ClassMethods[Logfile, Logfile::ActiveRecord_Relation]
attr_accessor id (): Integer
def id_changed?: () -> bool
def id_change: () -> [Integer?, Integer?]
def id_will_change!: () -> void
def id_was: () -> Integer?
def id_previously_changed?: () -> bool
def id_previous_change: () -> Array[Integer?]?
def id_previously_was: () -> Integer?
def restore_id!: () -> void
class Logfile < ApplicationRecord
belongs_to :report
validates :report_id, :presence => true
validates :ext,
:uniqueness => { :scope => :report_id },
:inclusion => { :in => %w[log.txt diff.txt log.html diff.html],
:message => "%{value} is not a valid ext" }
validates :data, :presence => true
def uri
r = report
t = r.datetime.strftime('%Y%m%dT%H%M%SZ')
"#{r.server.uri}ruby-#{r.branch}/log/#{t}.#{ext}.gz"
end
end