Displaying 20 results from an estimated 4000 matches similar to: "BigDecimal column type?"
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 Apr 09
16
Mapping to BigDecimals instead of Floats
Hi everyone,
I''m new to Rails and Ruby, and have been working my way through the Pickaxe
and Agile Rails books for the last week or so. With a background in payroll
apps I found that the default ActiveRecord mapping of decimal columns to
float variables really bothered me! Financial calcs need high levels of
accuracy and floats just don''t give you that.
I know there are a bunch
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
2007 Mar 26
2
Failure creating model in spec setup not reported?
Hi
I''ve just tracked down a wierd error that AFAICT is caused by an
error not being raised in the setup:
context "An Asset" do
setup do
@provider = Provider.create(:name => "Provider1")
@product = Product.new(:name => "Product1", :provider =>
@provider)
@applicant = Applicant.new(:first_name =>
2008 Nov 07
15
any tricks re using " eql(5.5)", but where 5.5 is a decimal not float?
--
Sent from my mobile device
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.
2007 Oct 31
16
Am I missing something with Heckle?
Hi
I can''t get heckle working. In fact, I''ve built an example so simple
that it either shows a bug, or I am being really, REALLY stupid.
Heckle does not appear to support RSpec directly, so I''m trying to use
spec --heckle (RSpec trunk as of 10 mins ago, Heckle 1.4.1). I''ve
constructed this pair of sample files:
18> ~/Desktop/heckle_test % cat
2006 Apr 11
2
Schema.rb and MySQL decimal
Hi,
I have a mysql schema with some decimal(20,20) fields. Now, I made a
rake db_schema_dump for deployment of my applications on other machines.
Rails created a schema.rb with the decimal fields as float.
After a rake db_schema_import the fields are just float not decimal. How
can I force rails to create decimal(20,20) columns instead of float?
Thx.
Marc
--
Posted via
2006 Jul 30
34
ruby suitable for financial apps?
hi there,
I am about to embark on a mission critical financial web application,
and was wondering weather ruby on rails is the best fit for this type
of project.
More specifically I am worried about floating point errors. Would it be
more appropriate to use a more statically typed framework (.NET)?
thankyou.
--
Posted via http://www.ruby-forum.com/.
2008 Aug 01
2
BigDecimal to letters
Is there a method that converts BigDecimal 1520.0 to "one thousand five
hundred and twenty"?
--
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 this group, send email to
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
2007 Oct 21
10
Preferred mock framework
Hi
In light of the fact that RSpec mocks are going into maintenance mode
in the near future, I was wondering what everyone was switching to.
I liked the look of FlexMock most, so gave that a shot. However,
there''s a few things that don''t work well with RSpec due to the
traditional differences in the way Test::Unit cases are written vs
RSpec specs. (One spec per
2007 Feb 13
7
Specs of code that use Time.now
Hi
Just trying to spec a Rails model that defaults a valid_until date to
this time tomorrow. I''ve done something similar involving Dates, and
you can stub the :today method to return something fixed. But when I
tried this with Time, I found that RSpec calls Time.now four times
per spec. So there''s no way to spec code like 1.days.from_now . The
best I can come up
2007 Aug 08
9
RSpec book?
<http://www.apress.com/book/bookDisplay.html?bID=10368>
Came across this as a stub page browsing Amazon UK. This is good
news! I''m surprised it hasn''t been discussed on the list before.
Was Chad keeping it a secret?
I hope it will have plenty of BDD theory. I''m still waiting for that
magic book I can give to someone and say "here - read this, it
2007 Oct 23
10
How is everyone structuring stories?
Bleeding-edge story-writers,
How are you structuring your specs?
I am working on a new project and tried this:
./lib
./blah
./spec
./blah
./stories
But it breaks autotest, so I moved stories parallel to lib and spec.
Also what about suffixes?
I have adopted "xyz_story_spec.rb", and "xyz.story" for the time
being, with the line
runner =
2007 Sep 03
20
Reason for _spec.rb convention
Hi
Easy one - I just wondered why all spec files for rspec_on_rails end
"_spec.rb" instead of just ".rb"? They are all inside the spec
folder so surely the fact they are specs is implicit?
Ashley
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
2007 Jun 14
4
Can''t run RSpec files in TextMate
Hi
Not sure if this is the place to ask this or not. I''ve upgraded to
RSpec 1.0.5, installed the latest TextMate bundle, but whenever I do
"Run Behaviour Descriptions in selected files/directories" I get this:
/Users/ashleymoran/Library/Application Support/TextMate/Pristine Copy/
Bundles/RSpec.tmbundle/Support/lib/spec_mate.rb:18:in `run_files'':
private method
2007 Oct 28
4
A better way to stub out constants
Hi
Something that''s gnawing at me... to avoid using the SQLite3 gem I''m
stubbing it out like this:
before(:each) do
@database = mock("SQLite3 database")
SQLite3 = Module.new
SQLite3::Database = Class.new
SQLite3::Database.stub!(:new).and_return(@database)
end
But then it keeps nagging me:
2007 Jul 11
21
"they" synonym for "it"?
I''ve noticed that I phrase a lot of shared behaviours in plural, eg
describe "All payment_details views"
How about a "they" alias to "it" so you can write
describe "All payment_details views", :shared => true do
they "should have a card number field" do
# ...
end
end
WDYT?
Ashley