created template selecting

This commit is contained in:
Senad Uka
2016-02-21 11:59:13 +01:00
parent 7af44a6245
commit 709ce3e38c
46 changed files with 584 additions and 20 deletions

View File

@@ -0,0 +1,5 @@
module Iconizable
def safe_icon
icon or 'chub.png'
end
end

View File

@@ -0,0 +1,5 @@
class ConfigurationFile < ActiveRecord::Base
belongs_to :server
belongs_to :file_type
has_many :file_versions
end

View File

@@ -0,0 +1,6 @@
class ConfigurationTemplate < ActiveRecord::Base
belongs_to :operating_system
belongs_to :file_type
include Iconizable
end

View File

@@ -0,0 +1,3 @@
class FileType < ActiveRecord::Base
has_many :configuration_files
end

View File

@@ -0,0 +1,3 @@
class FileVersion < ActiveRecord::Base
belongs_to :configuration_file
end

View File

@@ -1,3 +1,5 @@
class OperatingSystem < ActiveRecord::Base
has_many :servers
has_many :configuration_templates
include Iconizable
end

View File

@@ -1,8 +1,13 @@
class Server < ActiveRecord::Base
belongs_to :operating_system
before_create :generate_hash
has_many :configuration_files
def generate_hash
self.namehash = SecureRandom.hex
end
def to_s
"#{name} - #{namehash}"
end
end