Create data_version.rb
Adds a model for DataVersion
This commit is contained in:
parent
8248b33d4b
commit
82eed14338
1 changed files with 13 additions and 0 deletions
13
app/models/data_version.rb
Normal file
13
app/models/data_version.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
class DataVersion < ActiveRecord::Base
|
||||||
|
validates :filename, presence: true, uniqueness: true
|
||||||
|
validates :imported_at, presence: true
|
||||||
|
|
||||||
|
def self.mark_as_imported(filename)
|
||||||
|
create!(filename: filename, imported_at: Time.current)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.imported?(filename)
|
||||||
|
exists?(filename: filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue