Hey, sorry for the delay. I'll check with Yves and Matthew to see what they think about it but I'm positive for this addition.
Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Fri, Sep 12, 2014 at 9:14 AM, Andrey Novikov <[email protected]> wrote: > I still want to do it. > > There is some need to improve ActiveSupport::Duration (add ability to be > created by parsing from ISO 8601 Duration > <https://en.wikipedia.org/wiki/ISO_8601#Durations> and to be output to > it), may be also fix some things. I've found awesome gem ISO8601 > <https://github.com/arnau/ISO8601> but it's reimplement all types (date, > times, durations). I can pick some required logic from it into > ActiveSupport::Duration (or may be it's better to use the whole gem in > Rails?). Should these changes go into separate pull request or not? > > вторник, 26 августа 2014 г., 15:11:05 UTC+4 пользователь Andrey Novikov > написал: > >> How about to add support for interval datatype in rails? There is >> ActiveSupport:Duration class, that allows to use magic like 10.hours >> >> I want to do something like: >> >> create_table :events do |t| >> t.string :name >> t.interval :duration >> end >> >> Event.create(name: 'Greatest event', duration: 5.hours + 30.minutes) >> Event.last.duration # => 19800 >> Event.last.duration.inspect # => "330 minutes and 0 seconds" >> >> I've done some working (at first glance) initializer for Rails 4.1 here: >> https://gist.github.com/Envek/7077bfc36b17233f60ad >> >> So, if Core Team agree I'll be happy to make pull request for current >> master with this stuff (with tests and all input|output formats from >> documentation: http://www.postgresql.org/docs/9.4/static/datatype- >> datetime.html#DATATYPE-INTERVAL-INPUT ). >> >> But I don't sure about ActiveSupport::Duration. It's weird and magic >> thing I'm afraid of. >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
