similar to: Storing "money" in databases

Displaying 20 results from an estimated 1000 matches similar to: "Storing "money" in databases"

2006 Jun 14
5
InstantRails Lost connection to MySQL server
Hiall, I just tried out InstantRails version 1.3a. After a virgin install and filling the fresh mysql db with my app schema, I tried runningthe app with webrick, only to see the infamous "Lost connection to mysql server" for every action. What is it that I''m doing wrong? I also have mysql 5 installed on my machine, but the service is stopped while experimenting with
2006 May 01
7
ActiveRecord and Database Views
Hiall, If I have say 10 tables that i would like to wrap up in 1 view to manipulate data inside these tables, do I then need 10 model.rb files for all 10 tables plus 1 for the view, or do I just need 1 model.rb file for the view ? cheers Martin
2006 May 22
15
collection_select default selected value
Hiall, Unfortunately I just can''t find out how to setup a default selected value when using collection_select. My call is like so: <%= collection_select(:consultant, :lastname, @consultants, :id, :lastname, { :selected => @current_consultant.id } ) %> which is not working, I debugged so far that I know that @current_consultant.id contains the correct value. Any tips? cheers
2006 May 18
6
Form actions with additional parameters
Hiall, I want to give the action of a form an additional parameters but can''t figure out how to do it. My code looks like this <%= start_form_tag :action => ''create'', next_step => true %> <%= render :partial => ''user_form'' %> <%= render :partial => ''community_form'' %> <%= submit_tag
2006 May 09
3
Named link to image
Hiall, Call me stupid if you like .,) but it seems i can''t figure out how to get a named link using a combination of link_to and image_tag. What I need is basically a link displaying a name along with some image to indicate status (open,working,finished). I found no combination of link_to and image_tag that accepts a name, this seems to be solely used for making whole images into links
2006 May 14
6
file and directory layout below app/models
Hiall, Is it possible to organize my model files below app/models into subfolders? E.g. I would like to put admin related models into their own subfolder. This kind of structuring works for controllers and views (scaffolding creates the right subfolder-model mappings), but app/models always stays flat. I''d really like to be able to group my code into logical, well packages :-) Yes, I
2006 May 14
4
script/console on windows
Hiall, When I try to run script/console from a windows command line like f:\rails_app\ruby script\console I get the following error: F:/Programme/Ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'': no such file to load -- initializer (LoadError) from F:/Programme/Ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require''
2006 Jul 10
4
Advice on handling money
Hi, I''m trying to handle money within an online store I''m building and I''m very stuck. I understand that using a float in the db is bad because of "rounding errors", and that storing the price as an integer is the best way forward. I know this has been brought up before on the list and I have search the archives but can''t find a good way forward.
2006 May 17
1
Experiences with ModelSecurity
Hiall, I would be very interested in your opinions on the ModelSecurity plugin by Bruce Perens. http://perens.com/FreeSoftware/ModelSecurity/Tutorial.html Some time ago, I read on a few pages that it is the way to go, on this list however, I didn''t read much about it. Apart from it''s security level, quoted from comments in source code: # FIX: At the moment we only support
2006 May 23
3
image_tag problem
Hiall, I want to make an image_tag from within a controller in order to be able to present a link (with a status image) in a view. Here is my controller method (in file webca_controller.rb, hence WebcaController) def untouched_status_image_tag image_tag("open", { :alt => "Offen", :title => "Offen", :size => "12x12", :class =>
2006 Jul 21
1
saving money as decimals now ok?
Now that Rails core converts a database''s decimal type into a Ruby BigDecimal type, is it ok to now store money information as a decimal in the database (instead of an integer)? Joe
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/.
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 Jul 01
8
Seeking Advice on Pattern for Multi-Organization Application
I am the developer of FreeMIS - an Open Source management information system for schools. It currently holds the data for one school - so different schools host different instances of FreeMIS. I would like to expand the domain of a single instance of FreeMIS, so that it covers all the schools in an education authority. THis will enable me to implement authority-wide functionality. Is there
2010 Dec 23
36
Weird issue with converting floats to integer
Any idea why this calculates the integer the way it does? irb> ("291.15".to_f * 100.0).to_i => 29114 Thanks, Tom -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
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
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.
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
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