2016-02-20 12:36:50 +01:00
|
|
|
class Server < ActiveRecord::Base
|
|
|
|
|
belongs_to :operating_system
|
|
|
|
|
before_create :generate_hash
|
2016-02-21 11:59:13 +01:00
|
|
|
has_many :configuration_files
|
2016-02-20 12:36:50 +01:00
|
|
|
|
|
|
|
|
def generate_hash
|
|
|
|
|
self.namehash = SecureRandom.hex
|
|
|
|
|
end
|
2016-02-21 11:59:13 +01:00
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
|
"#{name} - #{namehash}"
|
|
|
|
|
end
|
2016-02-20 12:36:50 +01:00
|
|
|
end
|