Sha256: eb653b6794011d4008df1e4baccfb5f5ef9b8ba42c32ba384bcc382e2283ca9e
Contents?: true
Size: 818 Bytes
Versions: 2
Compression:
Stored size: 818 Bytes
Contents
# Transfer schedule_items from previous year def transfer_schedule_items current = Event.current past = Event.lookup('2012') Event.current.dates.each_with_index do |day, i| past_date = past.dates[i] offset = (day - past_date).days past.schedule_items.select{|s| s.start_time.to_date == past_date}.each do |past_schedule_item| new_attributes = past_schedule_item.attributes new_attributes.delete("created_at") new_attributes.delete("updated_at") new_attributes.delete("id") new_attributes.delete("room_id") new_attributes["start_time"] += offset new_schedule_item = current.schedule_items.new(new_attributes) puts "#{new_schedule_item.start_time}: #{new_schedule_item.title}" new_schedule_item.save end end end transfer_schedule_items()
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open_conference_ware-1.0.0.pre2 | util/transfer_schedule_items.rb |
open_conference_ware-1.0.0.pre1 | util/transfer_schedule_items.rb |