I have a simple event model (name, date, user) And I created a monthly calendar of events (gem 'watu_table_builder'). I need a function to create repeating events. I realized that I can use gem ice_cube for this. But this is not clear to me.
I added to the model:
class Event < ActiveRecord::Base
include IceCube
belongs_to :user
validates :title, :presence => true,
:length => { :minimum => 5 }
validates :shedule, :presence => true
def self.events_and_repeats(date)
@events = Event.where(shedule:date.beginning_of_month..date.end_of_month)
@events_repeats = @events
return @events_repeats
end
1) How can I combine repeat rules with the Events array?
2) As far as I understand, I can save repetition information in db in yaml yaml = schedule.to_yaml
But itโs not clear to me how this is a good way to create a drop-down list for replays (not a single one, every day, every month, every year) and not associate it with schedule rules. Where and how should I understand this (convert user selection to the correct schedule)