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.

Reply via email to