progressions / natural_time

Smart enumeration of lengths of time in natural language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No such method 'year' in 1:FixNum

robermorales opened this issue · comments

Does not require that gem the 'days_and_times' one?

I'm not sure I understand--I'm not familiar with the gem 'days_and_times'.

irb(main):001:0> require 'natural_time'
=> true
irb(main):002:0> NaturalTime.new(0)
NoMethodError: undefined method year' for 1:Fixnum from /var/lib/gems/1.9.1/gems/natural_time-0.0.4/lib/natural_time.rb:52:inblock in elapsed_time'
from /var/lib/gems/1.9.1/gems/natural_time-0.0.4/lib/natural_time.rb:51:in each' from /var/lib/gems/1.9.1/gems/natural_time-0.0.4/lib/natural_time.rb:51:inelapsed_time'
from /var/lib/gems/1.9.1/gems/natural_time-0.0.4/lib/natural_time.rb:14:in initialize' from (irb):2:innew'
from (irb):2
from /usr/bin/irb:12:in `

'

Interesting. I'll take a look at it but pull requests are welcome!

As of rails 3 active_support does not load anything by default anymore. You need to explicitly require the needed extensions. For your purpose you need these two:

require 'active_support/core_ext/integer'
require 'active_support/core_ext/numeric'

Alternatively you could just require the whole bunch with require 'active_support/all'.
(see http://guides.rubyonrails.org/active_support_core_extensions.html)

pull request -> #2