Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:21:58+00:00 2026-06-02T13:21:58+00:00

I want to create recurring events using the Ice Cube gem in Rails –

  • 0

I want to create recurring events using the Ice Cube gem in Rails – my question is, how do I then correctly, or rather efficiently, use these recurring rules for triggering actual events?

An example of this would be a recurring invoice.

Say I have an Ice Cube recurrence set for once a week and I saved it to a recurring invoice row using to_yaml. I now have a row in the database with a serialized recurrence rule. The only way I can imagine using this is to run through each and every row in the database, unserializing the saved recurrence rules and checking whether it needs to run today with schedule.occurs_on?(Date.new) – this would then be put into a cronjob that runs daily:

items = RecurringItem.find(:all)
items.each do |item|
    schedule = Schedule.from_yaml(item.schedule_yaml)
    if schedule.occurs_on?(Date.new)
        #if today is a recurrence, do stuff!
    end
end

This looks terribly inefficient to me – but I might be doing it completely wrong. Is there no better way to use Ice Cube?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:22:00+00:00Added an answer on June 2, 2026 at 1:22 pm

    Ice Cube seems to specialize in setting up very complicated schedules (occurs on the 1st and 4th wednesdays, but only if they’re even numbered days, and not if a weekend, etc.)

    If that’s what you need, then the task you described probably IS the most efficient way to run a number of tasks every day on that kind of complex schedule. If you don’t need that complexity in your schedules, then you could look at something like whenever (as MatthewFord mentioned), which just uses cron schedules to setup tasks to be executed, but that’s intended for admin-type tasks, and so requires a config file to be edited, and doesn’t work if you need to be adding and removing things via your application interface.

    Another option for using Ice Cube would be to have a monthly cron go through every schedule, and set up another table defining which events have to be run on which days for the next month. (each row has a date and a task definition), and your daily cron could select from that table…

    You would also have to update that table for one month ahead of time every time one of the schedules changed in the application… kind of a hassle, so unless you have hundreds of thousands of schedules to look through once a day, it’s probably not worth the trouble.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to create a function which calculates a value using a query and
Goal: I want to get the text from the selected element and then create
I want create a drop shadow around the canvas component in flex. Technically speaking
I want create a excel with Apache POI in java and I must insert
i want create image animation , i have 50 images with png format now
I want create module which update list of usb devices automatically (not only mass
I am trying ebook reading app. In that I want create UIActionSheet by clicking
I want to create a textbox which text binds an integer (e.g 123456789), but
I want to create a php variable depending on what was selected in a
I want to create 5 variables of type array all at once. Is this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.