TypeError: ActiveSupport::Duration can't be coerced into Fixnum

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TypeError: ActiveSupport::Duration can't be coerced into Fixnum

Timor Tsentsiper

I Just upgraded old rails app (3.2.22) to rails 4.2.10 and I am not sure if this is the right place but after a few hours of research, I am a little stumped. BRAND NEW rails 4.2.10 (same ruby) projects work (the behavior below does not happen) but this upgraded project fails on any instance of the ActiveSupport:: Duration functions. Did I miss something in the upgrade? Is it a gem issue? load order?

its not just Fixnum its any of these ActiveSupport::Duration functions

Expected behavior

irb(main):001:0> 20.days
=> 20 days
irb(main):002:0> 20.days.from_now
=> Wed, 13 Jun 2018 22:35:42 UTC +00:00

Actual behavior

irb(main):003:0> 20.days
TypeError: ActiveSupport::Duration can't be coerced into Fixnum
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/numeric/time.rb:35:in `*'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/numeric/time.rb:35:in `days'
	from (irb):3
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:110:in `start'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:9:in `start'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'
irb(main):004:0> 20.days.from_now
TypeError: ActiveSupport::Duration can't be coerced into Fixnum
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/numeric/time.rb:35:in `*'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/numeric/time.rb:35:in `days'
	from (irb):4
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:110:in `start'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:9:in `start'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /Users/ttsentsiper/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

System configuration

Rails version: 4.2.10

Ruby version: ruby 2.3.1p112

I also tried upgrading to ruby 2.4 on the same project and the issue persists (seems not ruby related)
Also copied the gemfile from the project that does not work into a new project and things seem ok

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/47521389-5d13-4c3e-b18f-6a1cee5edc86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.