Sha256: 93933ae9444ac46afdbf83b21867b0fcb371617c92dfbe9e416fe13ba927147e

Contents?: true

Size: 668 Bytes

Versions: 26

Compression:

Stored size: 668 Bytes

Contents

class Participator
  def self.create!(attendee_hash)    
    event_id = attendee_hash.delete :event_id
    attendees = []
    attendee_hash.each do |participant_class, participant_ids|
      participant_class = participant_class.to_s.classify.constantize
      if Participant.types.include?(participant_class)
        participant_ids.each do |participant_id|
          next if participant_id.blank? || participant_class.blank?
          attendees << Attendee.create!({
            :event_id => event_id,
            :participant_id => participant_id,
            :participant_type => participant_class
          })
        end
      end
    end
    attendees
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
event_calendar_engine-0.2.15 app/models/participator.rb
event_calendar_engine-0.2.14 app/models/participator.rb
event_calendar_engine-0.2.13 app/models/participator.rb
event_calendar_engine-0.2.11 app/models/participator.rb
event_calendar_engine-0.2.10 app/models/participator.rb
event_calendar_engine-0.2.8 app/models/participator.rb
event_calendar_engine-0.2.7 app/models/participator.rb
event_calendar_engine-0.2.6 app/models/participator.rb
event_calendar_engine-0.2.5 app/models/participator.rb
event_calendar_engine-0.2.4 app/models/participator.rb
event_calendar_engine-0.2.3 app/models/participator.rb
event_calendar_engine-0.2.2 app/models/participator.rb
event_calendar_engine-0.2.1 app/models/participator.rb
event_calendar_engine-0.2.0 app/models/participator.rb
event_calendar_engine-0.1.11 app/models/participator.rb
event_calendar_engine-0.1.10 app/models/participator.rb
event_calendar_engine-0.1.9 app/models/participator.rb
event_calendar_engine-0.1.8 app/models/participator.rb
event_calendar_engine-0.1.7 app/models/participator.rb
event_calendar_engine-0.1.6 app/models/participator.rb