Last active
December 21, 2015 11:08
-
-
Save varunlalan/6296273 to your computer and use it in GitHub Desktop.
Edit 'Only this event' in recurring event series.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Event schedule assumed here is: Weekly 5 times on Tuesdays, Wednesdays, and Thursdays | |
irb> existing_event.schedule.all_occurrences | |
=> [2013-08-20 16:09:08 +0530, 2013-08-21 16:09:08 +0530, 2013-08-22 16:09:08 +0530, 2013-08-27 16:09:08 +0530, 2013-08-28 16:09:08 +0530] | |
# Selected option - Only this event | |
# Event time being edited is 2013-08-27 16:09:08 +0530 | |
# First, create another event on 2013-08-27 16:09:08 +0530 | |
# with updated params. | |
# Then add exception time to recurrence rule of existing event. | |
# Following are the commands. | |
irb> schedule = existing_event.schedule | |
=> Weekly 5 times on Tuesdays, Wednesdays, and Thursdays | |
irb> schedule.add_exception_time(Time.parse("2013-08-27 16:09:08 +0530")) | |
=> 2013-08-27 16:09:08 +0530 | |
irb> existing_event.schedule = schedule | |
=> Weekly 5 times on Tuesdays, Wednesdays, and Thursdays / not on August 27, 2013 | |
irb> existing_event.save | |
=> true | |
irb> existing_event.schedule.all_occurrences | |
=> [2013-08-20 16:09:08 +0530, 2013-08-21 16:09:08 +0530, 2013-08-22 16:09:08 +0530, 2013-08-28 16:09:08 +0530] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment