Class: WorldDB::Models::Prop

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/worlddb/models/prop.rb

Class Method Summary collapse

Class Method Details

.create_from_worlddb_fixture!(name, path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/worlddb/models/prop.rb', line 7

def self.create_from_worlddb_fixture!( name, path )
  key   = "db.#{fixture_name_to_prop_key(name)}.version"

  if path.starts_with?( WorldDB.data_path )
    value = "world.yml.#{WorldDB::VERSION}"  # assume builtin
  else
    value = "file.txt.#{File.mtime(path).strftime('%Y.%m.%d')}"
  end

  Prop.create!( key: key, value: value )
end