recurring_select icon indicating copy to clipboard operation
recurring_select copied to clipboard

Could you please develop the demo app into a example app?

Open creativetags opened this issue 11 years ago • 5 comments

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?

creativetags avatar Jun 05 '13 16:06 creativetags

Is https://github.com/GetJobber/recurring_select/blob/master/spec/dummy/app/views/sample/index.html.erb at all helpful?

forrest avatar Jun 05 '13 16:06 forrest

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?

creativetags avatar Jun 05 '13 16:06 creativetags

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.

forrest avatar Jun 05 '13 16:06 forrest

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.

nathany avatar Jun 27 '13 21:06 nathany

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.

dchun avatar Jul 22 '13 18:07 dchun