module MongoidOccurrenceViews::Event::ClassMethods

Public Instance Methods

embeds_many_occurrences(options = {}) click to toggle source
# File lib/mongoid_occurrence_views/event.rb, line 12
def embeds_many_occurrences(options = {})
  embeds_many :occurrences, class_name: options.fetch(:class_name)
  accepts_nested_attributes_for :occurrences, allow_destroy: true, reject_if: :all_blank

  CreateExpandedOccurrencesView.call(self) unless embedded?
  CreateOccurrencesOrderingView.call(self) unless embedded?
end