Re: [Activewarehouse-discuss] truncate decimal?

2009-04-01 Thread Thibaut Barrère
 with :float works even if I am surprised that round the value using
:decimal

I think you'll need to specify a scale and precision if you want to use
:decimal. Here's an example:
  t.decimal :latitude, :precision = 20, :scale = 15
  t.decimal :longitude, :precision = 20, :scale = 15

That's probably why it get rounded. See
http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.htmlfor
the ranges of precision and scale depending on your DB.

cheers!

-- Thibaut

On Wed, Apr 1, 2009 at 1:01 PM, Giovanni Messina jgam...@gmail.com wrote:

 Hi, thanks for the suggestion

 with :float works even if I am surprised that round the value using
 :decimal

 cheers

 Giovanni



 2009/4/1 Thibaut Barrère thibaut.barr...@gmail.com

 Hello Giovanni,
 it would be useful to know if the decimals are still there in the bulk
 file (I suppose so) or if they are still there.

 If it can help you, in my cases I use :float in the migration (which is
 good enough for me) and things seem to work fine.

 cheers,

 -- Thibaut

 2009/3/31 Giovanni Messina jgam...@gmail.com

 Using this post_process I lose the decimal places of which there are
 suggested_retail_price in outfile

 ---
 in the ctl file:

 post_process :bulk_import, {
:file = outfile,
:truncate = true,
:columns = [:id,:description,:suggested_retail_price],
:field_separator = \t,
:target = :development,
:table = 'product_dimension'
  }

 -

 the migration file is

 :id = :integer,
 :description = :string,
 :suggested_retail_price = :decimal

 ---

 how do I act?

 Giovanni

 ___
 Activewarehouse-discuss mailing list
 Activewarehouse-discuss@rubyforge.org
 http://rubyforge.org/mailman/listinfo/activewarehouse-discuss




___
Activewarehouse-discuss mailing list
Activewarehouse-discuss@rubyforge.org
http://rubyforge.org/mailman/listinfo/activewarehouse-discuss


[Activewarehouse-discuss] truncate decimal?

2009-03-31 Thread Giovanni Messina
Using this post_process I lose the decimal places of which there are
suggested_retail_price in outfile

---
in the ctl file:

post_process :bulk_import, {
   :file = outfile,
   :truncate = true,
   :columns = [:id,:description,:suggested_retail_price],
   :field_separator = \t,
   :target = :development,
   :table = 'product_dimension'
 }

-

the migration file is

:id = :integer,
:description = :string,
:suggested_retail_price = :decimal

---

how do I act?

Giovanni
___
Activewarehouse-discuss mailing list
Activewarehouse-discuss@rubyforge.org
http://rubyforge.org/mailman/listinfo/activewarehouse-discuss