Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshalling and Unmarshalling #24

Open
IvanShamatov opened this issue Jun 9, 2016 · 3 comments
Open

Marshalling and Unmarshalling #24

IvanShamatov opened this issue Jun 9, 2016 · 3 comments

Comments

@IvanShamatov
Copy link

Hello @fnando
Thanks for creating this really nice gem to use recurrence. I've spent lots of time trying to create same logic in my project working from database abilities and not recurrence nature of my events. But this gem is what I need.
Though I still need to store initialization information in my database. And for now, I suppose really simple solution is just make store initial string in json.
But what I'm thinking about are some features most people can look for:

  • Marshalling and Unmarshalling it into crontab string and restoring recurrence object from it?
  • making some rails helper, that will work with active_record
    like: mount_recurrence :rec and will return recurrence object on initialization.

I'm really interested in some of these features, though it might be not the best place for that.
So what do you think about that?

@fnando
Copy link
Owner

fnando commented Jun 9, 2016

I usually keep some columns (or a JSONB column in PostgreSQL) with all the values I need. I don't think specific helpers for this are required because it's fairly simple. If you're going the JSON column route, you can easily store each of the initialization values in its own key.

Then you can have a method/class that loads this information and initializes a new Recurrence object.

Again, since the logic is really simple, I don't think it makes sense trying to create abstractions.

@IvanShamatov
Copy link
Author

Yes, sounds reasonable. And what you think about having method like to_cron and to_recurrent. This possibly can give some selecting query abilities? I didn't benchmark it, just guesses...

@RedaBenh
Copy link

+1 for to_cron method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants