class MEvent < ApplicationRecord
  belongs_to :circuit
  belongs_to :organisateur

  acts_as_sorting :fields => {
    :id => {:name => "Id", :reorder => true},
 
    :m_event_type_title => {:name => "Type d'évenement", :reorder => true},
    :circuit => {:name => "Circuit", :reorder => true},
    :organisateur => {:name => "organisateur", :reorder => true},
    :start_at => {:name => "Date de début", :reorder => true},
    :end_at => {:name => "Date de fin", :reorder => true},
    :title => {:name => "Titre", :reorder => true},
    
    :description => {:name => "Description", :reorder => true},
    :link => {:name => "Lien réservation", :reorder => true},
    
    
    :actions => {:name => "Actions", :reorder => false}
  }

  belongs_to :image_file

  def member_label
    self.start_at.to_s+" - "+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s
  end



end
