Displaying 20 results from an estimated 9000 matches similar to: "BigDecimal to letters"
2006 Mar 31
6
BigDecimal + Float => Float?
I was just playing around in irb and noticed that while BigDecimal + Integer
=> BigDecimal, BigDecimal + Float => Float. Is there any reason for this?
It seems inconsistent and means you have to check the class of any number you
add to a BigDecimal, which looks very un-Ruby-like to me.
Ashley
2006 Jul 09
6
Float -> BigDecimal
So, I''m personally cool with this change (patch from #5454, applied in
[4596]), and I''ll make it work for Oracle tomorrow.
But just wondering if folks considered the performance impact of the
change? From a simple test it seems that BigDecimal math is about twice
as slow as using Floats.
2009 Feb 03
4
Ruby EE: Problem with BigDecimal
I have a strange problem with my setup of Passenger and Ruby Enterprise
Edition.
Sometimes the loading of BigDecimals from the database and session fails
(silently) and the variable containing the BigDecimal is just empty.
I cannot pinpoint where/when/how it happens, and it IS only periodic.
I am using the newest versions of both Passenger and REE - I have even
tried to run with latest commit
2006 May 25
3
Storing BigDecimal in the db
I need to do some precise math, going to 12-14 decimal places, so I''m
using BigDecimal. How can I store this in a db? I''m using postgresql
8.1.0, if that matters at all. I found a plugin [1] but it gives me
the error "You have a nil object when you didn''t expect it! The error
occurred while evaluating nil.each_pair," with no line number. The
plugin itself
2006 Apr 01
7
BigDecimal column type?
I was hoping 1.1 would provide a way to map SQL "decimal" column types
to BigDecimal values, since BigDecimal is part of the Ruby standard api
as of 1.8.
But I don''t see any support for that in the migration documentation, and
when I try to let Active Record do the mapping for me, it seems to
coerce the column into a Float (as the AwdwR book says).
Is it really there in
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I
2006 Aug 01
6
Getting Started on RJS Templates
I definitely need to use RJS templates for my current application. I''ve
used Google for the past twenty minutes or so, yet I can''t find a good
resource that will get me started and show me what the page object can do.
Any links?
When an Ajax link is clicked, I''m trying to change the background of a
"primary" list item, as well as the background and text of
2006 Nov 28
15
Determining ideal number of Mongrels for an app?
What''s a rule of thumb for guesstimating how many
Mongrels to use in a cluster for an app? I have an app
that gets about 5000 unique visitors per day. I
figured I''d give it plenty of Mongrels -- twenty to be
specific. After running out of memory and hitting the
swap periodically, I scaled it back to five and it
still seems to serve up visitors fine. So, is there
some super-secret
2008 Jun 11
1
Resourse route in namespace with prefix error
Ok so I have this route
map.namespace :trades do |trades|
trades.resources :buys, :path_prefix => ''/trades/:contract_id''
end
I want the contract_id variable to filter a list of buys
then I try to open this route http://localhost:3000/trades/1/buys
I get a strange error:
ActionController::RoutingError in Trades/buys#index
Showing trades/buys/index.html.erb where line
2010 Oct 22
0
Overriding to_s method of BIgDecimal
I am overriding to_s method of BigDecimal class as below and its working
fine.
Wanted to confirm is there any other better way to do this ? Thanks!
49 class BigDecimal
50 alias :old_s :to_s
51 def to_s
52 return to_i.to_s if eql? to_i
53 self.old_s
54 end
55 end
--
sαη∂ιρ Rαηѕιηg
---
blog www.funonrails.com
twitter @sandipransing
skype sandip.ransing
--
You received
2007 Nov 13
4
question about activerecord test_numeric_fields in base_test.rb
There''s a test for activerecord called test_numeric_fields in
base_test.rb. here''s the test
def test_numeric_fields
m = NumericData.new(
:bank_balance => 1586.43,
:big_bank_balance => BigDecimal("1000234000567.95"),
:world_population => 6000000000,
:my_house_population => 3
)
assert m.save
m1 =
2006 Jul 21
20
New version of AWDwR
Folks:
I''ve uplaoded the B1.05 version of AWDwR. It fixes a number of
reported errata (and a few that weren''t reported :), and
adds two significant changes:
1. It now uses the new Active Record decimal -> BigDecimal
conversion. I''ve personally been waiting for this for a long
time, and I''m really happy it''s now part of core. However,
2009 Oct 07
1
output validations errors form causing type error?
Hi,
I was wondering if it is possible to output validation errors in a
nested form? I suppose this should be possible, but I am experiencing
an error message that I can''t track down.
The error I get is the following :
TypeError in Store/orders#create
Showing app/views/store/orders/new.html.erb where line #45 raised:
can''t convert Array into String
This is ocurring in the
2010 Jul 08
3
Testing equality
Hello
How can I test equality with two objects when they include some
attribute that is BigDecimal?
if I make something like this:
it "should ...whatever" do
obj = Factory.create(:my_object)
...
MyObject.first.should == obj
end.
FAILS
This fails because the object expected is different from the object
gotten, and the only difference are the BigDecimal attributes, that are
2005 Dec 31
2
numeric_spell plugin
I''ve created a plugin that lets you spell out numbers (under one
thousand, in English, for now).
Examples:
>> 23.spell
=> "twenty-three"
>> 23.spell :noun => ''person''
=> "twenty-three people"
>> (23.14).spell_currency
=> "twenty-three dollars and fourteen cents"
>>
2012 Feb 21
0
nil can't be coerced into BigDecimal Options
hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i
got stuck in
nil can''t be coerced into BigDecimal
error
i need to get the total cost of the products inside the cart i know
where the problem is(i think) but i almost did every thing
cart/show.html.rb
<div class="cart_title" >Your Cart</div>
<table>
<% for item in
2017 Oct 22
3
ASR Suggestions for small dictionnary (<1000 entries) lookup in France/french
Hello,
I'm in the early stages of designing an Emergency calling service IVR
application.
The IVR application asks simple one or two questions like "which is the
postal code of the area you are currently calling from ?" "Is the correct
?". The expected values are a 5-digits number like
"twenty-five-thousand-two-hundreds-twelve" or
2009 Jan 11
6
Why does ActiveRecord allow perception of success when updating an ID, however it doesn't really work(i.e. no change in database)?
Hi,
Why does ActiveRecord allow perception of success when updating an ID,
however it doesn''t really work(i.e. no change in database)?
Here''s an example. The update of "id" versus update of a non-existent
attribute.
?> ai = AccountItem.find(:first) => #<AccountItem id: 1, account_id: 1,
date: "2009-01-11", amount:
2010 Sep 04
2
Decimal numbers pain
Hi,
What do you guys use to definitely handle decimal numbers? This is
getting me crazy!
I use BigDecimal, but it craps out of the input number is something like
"14,53", Rails transforms it as 14.0
Any solution?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to
2009 Apr 27
2
[cucumber] Setting a constant in step definition
On Mon, Apr 27, 2009 at 7:00 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> Currently I have a very simple constants implementation being loaded as a
> Rails initialiser
>
> module MVOR
> ? module Postage
> ??? THRESHOLD = BigDecimal.new(''6.99'')
> ??? RATE = BigDecimal.new(''30.00'')
> ? end
> end
>
>
> My scenarios