Heroku casts oddity

I have the strangest experience of using faucets to move data between my machine and Heroku.

It works great, except that it seems to be losing 0s directly behind the decimal point for my geo coordinates, i.e. 50.0519322 gets the value 50.519322 for whatever reason ... not sure why.

When I pull data from a remote location i.e. heroku db: pull ... it works fine, all decimals stay the same on my machine, however when I push it to the remote server it loses those zeros. Especially right behind the decimal point, although I haven't noticed it elsewhere yet.

At first I kept lat and lng as just numeric, but refined it:

change_column :places, :lat, :numeric, :precision => 15, :scale => 10
change_column :places, :lng, :numeric, :precision => 15, :scale => 10

      

Without any results, any idea of ​​what is going on?

From the console on the remote server, I get lat as:

#<BigDecimal:2aebcc5967c0,'0.50519322E2',18(18)>

      

and my car:

#<BigDecimal:10232f7c8,'0.50519322E2',12(16)>

      

which is also odd, the second because it shows as 50.0519322 when i edit it through my view, but when i do to_f through the console it gives me 50.519322

Both server and local machine are postgres, storage as numeric.

+2


a source to share


1 answer


This sounds like a BigDecimal bug in Ruby: http://blog.ethanvizitei.com/2010/04/bug-with-bigdecimal-in-ruby-187.html

db:pull

and are db:push

best suited for development use. I recommend using the PGBackups system to move data without any changes between your local system and Heroku:



http://devcenter.heroku.com/articles/pgbackups

0


a source







All Articles