I'm attempting to utilize the [awesome] functionality of ice_cube and recurring_select gems to handle recurring events. I've got a schedule
(text) column in my database and the following in the event model:
def schedule=(new_schedule)
write_attribute(:schedule, RecurringSelect.dirty_hash_to_rule(new_schedule).to_yaml)
end
def converted_schedule
Schedule.from_yaml(self.schedule, :start_date_override => self.start_date)
end
Looking at the schedule column in psql, it appears to be storing the schedule correctly.
Here's my form:
.control-group
= f.label 'Date', :class => 'control-label'
.controls
= f.text_field :start_date, :class => 'datepicker'
.control-group
= f.label 'Recurring?', :class => 'control-label'
.controls
= f.select_recurring :schedule, :allow_blank => true
However, when I attempt to output converted_schedule
, it only shows the start date and won't show any additional dates. I have a few suspicions that I've tinkered with no success... perhaps the YAML isn't being converted correctly for the converted_schedule
method? Perhaps I need an end-date (I don't see where this functionality is available on recurring_select)?