Sorry for the delay in response, for some reason I never got a notification.. Glad you like IceCube so far!
First, the indexes in your code below should be 0-6, not 1-7 (where 0 is sunday) Also, you're missing your add_recurrence_rule call -- should be: schedule.add_recurrence_rule IceCube::Rule.weekly.day(*all_days) --- So, your full code with modifications > all_days = [] > all_days << 1 if params[:recurrent][:sun] > all_days << 2 if params[:recurrent][:mon] > all_days << 3 if params[:recurrent][:tue] > all_days << 4 if params[:recurrent][:wed] > all_days << 5 if params[:recurrent][:thu] > all_days << 6 if params[:recurrent][:fri] > all_days << 7 if params[:recurrent][:sat] > > schedule.add_recurrence_rule IceCube::Rule.weekly.day(*all_days) --- Also, a little more crazy - if you change how your params arre named, to be :monday, :tuesday, etc... you could skip the "all_days" stuff, and just write: schedule.add_recurrence_rule IceCube::Rule.weekly.day(*params[:recurrent].keys) Since day accepts symbols like that as well as numbers like you did. Hope this helps! On May 29, 5:41 pm, Aldo Italo <[email protected]> wrote: > Hi John. > I like this library, it was just what I wanted. > I am a newbie, i did not understand how to put dynamically the numbers > of the days in the method IceCube::Rule.weekly > > i have try this under Ruby on Rails: > > ###################### > > all_days = [] > all_days << 1 if params[:recurrent][:mon] > all_days << 2 if params[:recurrent][:tue] > all_days << 3 if params[:recurrent][:wed] > all_days << 4 if params[:recurrent][:thu] > all_days << 5 if params[:recurrent][:fri] > all_days << 6 if params[:recurrent][:sat] > all_days << 7 if params[:recurrent][:sun] > > schedule.add_recurrence_rule IceCube::Rule.weekly.day.all_days > > ##################### > > but i have an error > thank you. > > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

