What's the best way to model recurring events in a calendar application?

后端 未结 18 2544
感情败类
感情败类 2020-11-27 08:54

I\'m building a group calendar application that needs to support recurring events, but all the solutions I\'ve come up with to handle these events seem like a hack. I can li

18条回答
  •  忘掉有多难
    2020-11-27 09:16

    I'm working with the following:

    • http://github.com/elevation/event_calendar - model and helper for a calendar
    • http://github.com/seejohnrun/ice_cube - awesome recurring gem
    • http://github.com/justinfrench/formtastic - easy forms

    and a gem in progress that extends formtastic with an input type :recurring (form.schedule :as => :recurring), which renders an iCal-like interface and a before_filter to serialize the view into an IceCube object again, ghetto-ly.

    My idea is to make it incredibility easy to add recurring attributes to a model and connect it easily in the view. All in a couple of lines.


    So what does this give me? Indexed, Edit-able, Recurring attributes.

    events stores a single day instance, and is used in the calendar view/helper say task.schedule stores the yaml'd IceCube object, so you can do calls like : task.schedule.next_suggestion.

    Recap: I use two models, one flat, for the calendar display, and one attribute'd for the functionality.

提交回复
热议问题