recurring_select
recurring_select copied to clipboard
Could you please develop the demo app into a example app?
It would be really helpful to see some actual working code rather than just stubs. I'm struggling to understand here.
How am I meant to store the result in a model? How do I display that in a view? Use it in the controller?
Is https://github.com/GetJobber/recurring_select/blob/master/spec/dummy/app/views/sample/index.html.erb at all helpful?
That's what I meant by the demo app. I want to see a working example which would answer: How am I meant to store the result in a model? How do I display that in a view? Use it in the controller?
I'll see what I can do. In the meantime, for storing the data, I recommend a solution like this:
class RecurringModel
attribute_accessible :recurring_rule
serialize :recurring_rule, Hash
....
def recurring_rule=(new_rule)
if RecurringSelect.is_valid_rule?(new_rule)
write_attribute(:recurring_rule, RecurringSelect.dirty_hash_to_rule(new_rule).to_hash)
else
write_attribute(:recurring_rule, nil)
end
end
end
:recurring_rule
should be a text field in the DB.
Afaik, the dummy app is mostly there for the tests. Just found this cool gem for testing engines. Then perhaps we could have a sample app that's only purpose is to be a sample app.
Has anyone tried to store the :recurring_rule field as an hstore data type in PostgreSQL? I'm trying to do this with a rails 4.0 app to speed things up a bit and I'm running into issues.