28 lines
1.6 KiB
Ruby
28 lines
1.6 KiB
Ruby
|
|
module JamRuby
|
||
|
|
class IcecastTemplate < ActiveRecord::Base
|
||
|
|
|
||
|
|
|
||
|
|
belongs_to :limit, :class_name => "JamRuby::IcecastLimit", foreign_key: 'limit_id', :inverse_of => :templates
|
||
|
|
belongs_to :admin_auth, :class_name => "JamRuby::IcecastAdminAuthentication", foreign_key: 'admin_auth_id', :inverse_of => :templates
|
||
|
|
belongs_to :directory, :class_name => "JamRuby::IcecastDirectory", foreign_key: 'directory_id', :inverse_of => :templates
|
||
|
|
belongs_to :master_relay, :class_name => "JamRuby::IcecastMasterServerRelay", foreign_key: 'master_relay_id', :inverse_of => :templates
|
||
|
|
belongs_to :path, :class_name => "JamRuby::IcecastPath", foreign_key: 'path_id', :inverse_of => :templates
|
||
|
|
belongs_to :logging, :class_name => "JamRuby::IcecastLogging", foreign_key: 'logging_id', :inverse_of => :templates
|
||
|
|
belongs_to :security, :class_name => "JamRuby::IcecastSecurity", foreign_key: 'security_id', :inverse_of => :templates
|
||
|
|
|
||
|
|
has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :template, :foreign_key => "template_id"
|
||
|
|
has_and_belongs_to_many :listen_sockets, :class_name => "JamRuby::IcecastListenSocket", :join_table => "icecast_template_sockets"
|
||
|
|
|
||
|
|
validates :name, presence: true
|
||
|
|
validates :location, presence: true
|
||
|
|
validates :admin_email, presence: true
|
||
|
|
validates :fileserve, :inclusion => {:in => [true, false]}
|
||
|
|
|
||
|
|
validates :limit, presence: true
|
||
|
|
validates :admin_auth, presence: true
|
||
|
|
validates :path, presence: true
|
||
|
|
validates :logging, presence: true
|
||
|
|
validates :security, presence: true
|
||
|
|
validates :listen_sockets, length: {minimum: 1}
|
||
|
|
end
|
||
|
|
end
|