# encoding: utf-8 class ComVnccuProgram include Mongoid::Document include Mongoid::Timestamps include OrbitModel::Status include OrbitModel::Impression include OrbitCategory::Categorizable field :year field :semester field :program_name field :open_song, :type => Boolean, :default => false field :week field :hour field :description field :host, :type => Array field :create_user_id field :update_user_id has_many :com_vnccu_program_links, :autosave => true, :dependent => :destroy has_many :com_vnccu_program_song_lists, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :com_vnccu_program_links, :allow_destroy => true accepts_nested_attributes_for :com_vnccu_program_song_lists, :allow_destroy => true # scope :can_display, ->{any_of({:sign_start_date.lt=>Time.now, :sign_end_date.gt=>Time.now},{:sign_start_date.lt=>Time.now, :sign_end_date=>nil}).order_by([:is_top, :desc])} def get_hosts @role = Role.where(:key=>"host").first @nickname_field = AttributeField.where(:key => 'nickname', :role_id => @role).first @values = AttributeValue.where(:attribute_field_id => @nickname_field ).collect{|t|t[:val]}.join('-').split('-') return @values end def get_hosts_name(hosts=nil) return hosts.join(",") if !hosts.blank? end end