开发者

Heroku taps push weirdness

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

It works fine except that it seems to lose 0s directly behind the decimal place for my geo coordinates i.e. 50.0519322 for some reason gets set to 50.519322... no idea why.

When I pull the data from the remote location ie. heroku db:pull... it works fine, all decimal places intact开发者_Python百科 on my machine, however, when I push it back to the remote server it loses these zeros. Especially directly behind the decimal place, though I haven't noticed it elsewhere yet.

At first I was storing the lat and lng as simply numeric but refined it to:

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

With no result, any ideas what's going on?

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

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

and my machine as:

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

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

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


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

db:pull and db:push are best for development use. I recommend using the PGBackups system for moving data without any chance of change between your local system and Heroku:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜