Skip to content

NoMethodError: undefined method `rule=' for nil:NilClass #25

@sebastiandeutsch

Description

@sebastiandeutsch

Hi,

I'm trying out your gem and I'm getting an undefined method error with the following code (leaving recurring events aside for the moment):

event = calendar.events.where(uid: ical_event.uid.to_s).first_or_create
event.summary = ical_event.summary.to_s
event.description = ical_event.description.to_s

event.schedule.rule = "singular"
event.schedule.date = ical_event.dtstart
event.schedule.until = ical_event.dtend

event.save

These are my models:

class Event < ApplicationRecord
  acts_as_schedulable :schedule
end
class Schedule < Schedulable::Model::Schedule
end

Do I have to instantiate the schedule by myself - anything else that might be wrong?

Best

Sebastian

PS: That's my environment

ruby 2.2.2
Rails 5.0.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions