Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:27:44+00:00 2026-05-28T08:27:44+00:00

I have a scenario with code like the following: extracted_data = data.map{|row| ((row.some_long_number.to_f) if

  • 0

I have a scenario with code like the following:

extracted_data = data.map{|row| ((row.some_long_number.to_f) if BigDecimal(row.some_long_number) != BigDecimal("-1500.0")) }.reverse

When I run this on Rails 3.1.x with ruby 1.9.3 it works out fine, however when I shift this over to Heroku Cedar with the same Rails version but ruby 1.9.2, I end up with the following exception:

can't convert BigDecimal into String

app/controllers/some_controller.rb:12:in `BigDecimal'
app/controllers/some_controller.rb:12:in `block (2 levels) in index'
app/controllers/some_controller.rb:12:in `map'
app/controllers/some_controller.rb:12:in `block in index'
app/controllers/some_controller.rb:3:in `new'
app/controllers/some_controller.rb:3:in `index'

What could be going on here from ruby 1.9.2 to 1.9.3 that sets this off?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:27:45+00:00Added an answer on May 28, 2026 at 8:27 am

    From Ruby changelog:

    • bigdecimal/bigdecimal.c (BigDecimal_new): support generating a new
      BigDecimal from another BigDecimal using BigDecimal global function
      or constructor. [ruby-dev:44245]

    I suspect that BigDecimal(row.some_long_number) is making a BigDecimal of something that is already a BigDecimal. The constructor takes a String, so it is trying to coerce the BigDecimal to a string. The change in 1.9.3 allows for this, but 1.9.2 doesn’t.

    So you can do something like:

    row.some_long_number.respond_to?(:to_s) ? BigDecimal(row.some_long_number) : row.some_long_number

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: old legacy code in rpg have to consume data from a new web
I have the following scenario. The client code only has access to FooHandler, not
I have a scenario in the code where the following pattern exist - if
I have a problem with the following scenario (code cut for brevity). Basically the
I have been writing code like the following enough a lot lately. I don't
We have a scenario where some .NET code is attempting to access the current
Okay so I have a scenario similar to the below code, I have a
This is my current scenario: I have checked in my grails app code +
Say I have a simple client/server scenario with one method: // client code $client
Hey all. Here is the scenario. I have the below code, and I'm needing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.