Basit Etkinlik modelim var (başlık, tarih, kullanıcı) Ve Etkinlik Takvimini aylara göre oluşturdum (gem 'watu_table_builder'). Yinelenen olaylar yaratmak için özelliğe ihtiyacım var. Bunun için gem ice_cube kullanabileceğimi düşündüm. Ama benim için net değil.İstifleme olayları için gem ice_cube
Ben modele eklendi:
Ben Olaylar dizisi ile tekrar kuralları birleştirebiliriz nasılclass Event < ActiveRecord::Base
#require 'ice_cube'
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)
# Here I need to figure out what is events repeats at this month (from date param)
# how I may combine it with Events array
@events_repeats = @events # + repeats
return @events_repeats
end
1)?
2) Anlıyorum gibi, (I YAML içinde YAML = schedule.to_yaml
tekrarlar hakkında bilgi db kaydedebilir Ama buna tekrarlar için açılır oluşturmak için iyi bir yoldur nasıl benim için açık değildir yok, her gün, her ay, her yıl) ve shedule kuralları ile bağlantı kur. Nerede ve nasıl bunu fark etmeliyim (kullanıcı seçeğini sağdaki shedule çeviriniz)
"gem calendar_table" nedir ve ne yapar? Onu bulamıyorum. –
Üzgünüz, bu 'watu_table_builder'. – Gabi
Sadece sayfadaki takvim oluşturuldu. Index.html.erb dosyasındaki kod <% = calendar_for (@events,: year => @ date.year,: month => @ date.month) do | takvim | %> .................... <% end %> – Gabi