2

i would like to identify the details of an schedule. e.g:

i have the schedule for an event: event.schedule

"Every 3 months on the 10th day of the month"

represented by the hash:

  {
   :start_date=>2012-02-06 10:37:04 +0100, 
   :rrules=>[{
     :validations=>{
       :day_of_month=>[10]}, 
       :rule_type=>"IceCube::MonthlyRule", 
       :interval=>3
    }], 
    :exrules=>[], :rdates=>[], :exdates=>[] 
  }

to set the specific form elements (dropdown, checkbox) i need to evaluate the specific rules. e.g. for

  event.schedule.interval 

i would expect

  IceCube::MonthlyRule

i did not found any methods in the source, does somebody did sth. similar ? My approach would be to parse the hash and extract every rule...

fluxsaas
  • 997
  • 2
  • 11
  • 27

1 Answers1

2

You should be able to just look at the class for that information, but it is at the rule level, not the schedule level:

event.schedule.rrules.each do |rule|
  rule.class.name
end

There are a few projects around integrating IceCube with Rails. I'd definitely check them out

John
  • 549
  • 1
  • 5
  • 15
  • 1
    hey, thanks for the hint. i tried to find some examples but no luck so far (well this one: https://github.com/juno/rails-recurring-task-demo) do you have a link for me ? – fluxsaas Feb 08 '12 at 11:36