Ruby suitable for financial apps?

Ashley M. wrote:

On Jul 31, 2006, at 10:25 am, Guest wrote:

Thanks for all the responses to my post.
My general feeling is that Rails is not the most suitable for my type
of application at the moment although I wish it were.
Happy Railing!

Simon,

If it’s any use to you, the company I work for
( www.codeweavers.net ) produces almost exclusively financial
applications, and we are now starting to switch to Rails.

Ashley

Ashley,
may I ask what you are using before rails? You obviously think that
rails is worth the switch despite having to write a patch to support
decimal types, I don’t think that I would go to that much trouble ( I’m
a bit lazy and not that good a coder - or possibly have self esteem
issues :).

I thought that rails might not be good for number crunching apps because
I saw some stats on the web that suggest it was quite slow in comparison
(when it comes to doing math) and also because of the decimal types
thing. I don’t claim to be an expert so I could be wrong.

On Aug 03, 2006, at 3:50 pm, Guest wrote:

Ashley,
may I ask what you are using before rails?

Simon

We’ve used mainly C#/.Net, and used Flash for the front end of one app.

You obviously think that
rails is worth the switch despite having to write a patch to support
decimal types,

It was pretty much the only thing I didn’t like about Rails. You
have to be flexible when looking at Rails… it’s easy to come up
with a list of imaginary reasons not to use it, like… Ruby’s too
slow and not statically typed, Rails gets you started fast but isn’t
maintainable code, it’s not “enterprise level”, etc ad nauseam. When
you actually use it you realise how many benefits it offers, but if
in your mind that extra bit of work is worse than 10,000 XML situps,
you’re bound not to want to use it.

Admittedly, decimal support was a fairly big piece of work, but I
imagine everyone on the list with working Rails app has come across
something Rails doesn’t do (as if Java would do it for you!) but I
doubt any would want to switch to a different platform.

I don’t think that I would go to that much trouble ( I’m
a bit lazy and not that good a coder - or possibly have self esteem
issues :).

Lol… it was quite a bit of work and I didn’t have a clue what I was
doing at first, but it was worth it. Also poking around in the
Rails core gives you a better idea how it works. And it’s
beautifully constructed too. I wish we wrote code as well :slight_smile:

I thought that rails might not be good for number crunching apps
because
I saw some stats on the web that suggest it was quite slow in
comparison
(when it comes to doing math) and also because of the decimal types
thing. I don’t claim to be an expert so I could be wrong.

It depends… there’s just been a marathon thread on the ruby-talk
list called “For performance, write it in C”. The question you have
to ask is not how fast Rails or Ruby is, but is it fast enough? If
you want to simulate nuclear fusion or protein folding, then no, you
probably won’t want to use Ruby. But the ratio of developer to
hardware costs is now ridiculously high, so I doubt that language
runtime performance is the limiting factor for 99% of apps around today.

Ashley

Guest wrote:

I thought that rails might not be good for number crunching apps because
I saw some stats on the web that suggest it was quite slow in comparison
(when it comes to doing math)

I don’t think that applications like loan calculations have anything to
do with “number cruching”.

Hi Justin,

it shouldn’t matter, but there is going on so much magic in rails
because of
the naming conventions that you might try and use

<%= password_field “user”, “password” %> instead of

<%= password_field “users”, “password” %>

this is user instead of user___s___

The hash function might be simply the hash of an empty string…

Cheers,
Jan

Hey Justin - you should also check the post(get) from the form -
it’ll show you what was passed - you can post that section of your
development.log here

Plus it looks like you don’t have an ‘id’ (lowercase) column for your
users table - be sure to create on (type integer).

cheers,
Jodi

Hi all.
This is my first post here, so here goes…

http://pastie.caboo.se/7267

That is my MVC for the problem in question. I’m trying to create a
login module and I’m on account registration. The problem is when I
do @user = User.new(params[:users]) which should populate the
record, it instead yields

#<User:0x227c100 @password=“testt”, @email=“[email protected]”,
@new_record=true, @attributes={“installation_id”=>0,
“password_hash”=>“”, “email”=>“”}>

Instead of what it should (in my opinion) be, which is :

#<User:0x227c100 , @new_record=true, @attributes=
{“installation_id”=>50, “password_hash”=>“40char_hash_here”,
“email”=>“[email protected]”}>

When I do User.save I recieve the following SQL statement (taken from
dev.log)

SQL (0.000303) INSERT INTO users (installation_id,
password_hash, email) VALUES(0,
‘3da541559918a808c2402bba5012f6c60b27661c’, ‘’)

Any ideas on how I might fix this? Thanks!

-justin

Additional Info:

Intel Mac
Ruby 1.8.2
Rails 1.1.4
MySQL 4.1.21

Jan:

I just tried changing it to useR instead of userS and the result
was an error (NoMethodError) on my view. Specifically at the line
containing:

<%= password_field “user”, “password_confirmation” %>

undefined method `password_confirmation’ for #User:0x23ee90c

I do not get this error when they are ‘users’ instead of ‘user’. This
may have something to do with the fact that my Model is “user” but my
controller is “users” (silly thing to do, I think). (I was also sure
to change the call to params[:userS] to params[:useR] too.

Jodi:

The parameters passed are as follows:

Parameters: {“commit”=>“Register”, “action”=>“register”,
“controller”=>“users”, “users”=>{“installation_id”=>“59”,
“password_confirmation”=>“test”, “password”=>“test”,
“email”=>“[email protected]”}}

which resulted in the following SQL query (some logging):

attempting to save user
SQL (0.000185) BEGIN
User Load (0.000738) SELECT * FROM users WHERE (users.email =
[email protected]’) LIMIT 1
SQL (0.000380) INSERT INTO users (installation_id,
password_hash, email) VALUES(0,
‘a94a8fe5ccb19ba61c4c0873d391e987982fbbd3’, ‘[email protected]’)
SQL (0.073029) COMMIT
save successful

I did have an id field, but it is left out (it comes default) in
Schema.rb (and similarly with migrate files)

Hope this makes some sense. Its rather demeaning to not be able to
figure out a login module. chuckles

Thanks for the help,

-justin

Hi Jan,

Actually I’m not submitting the email. Again the sql statement is:

SQL (0.000303) INSERT INTO users (installation_id,
password_hash, email) VALUES(0,
‘3da541559918a808c2402bba5012f6c60b27661c’, ‘’)

Which is only submitting the hash. Again for readability:

SQL (0.000303) INSERT INTO users (installation_id,
password_hash, email) VALUES(0, ‘thehash’, ‘’)

I’m still at a loss of why this might be doing this as everything
APPEARS to be fine (at least to the ruby newbie). Any thoughts you
may have or leads towards getting it fixed would be great.

-justin

Hi Justin,

yes for the password_confirmation part you don’t need to set it to the
user
params. Just put it in another key-value pair of the params hash, since
you
need it only for confirmation issues and won’t save it to the db. For me
it
was always a convention to put things into a hash that has the same name
as
the Class and this would be the singularized ‘user’

You’ve made some progress though since now the email gets submitted. One
questions persists: Why isn’t the installation_id put into the insert
sql…

Cheers,
Jan

Hi Justin,

if you don’t mind post all of the stuff that matters user-model,
users-controller and the view and I’ll try it out here by myself. Maybe
I’m
able to find something.

Cheers,
Jan

I figured it out, though I don’t really know how. Thanks for your
help anyhow.

-justin

Hi Justin,

sorry for answering that late. I’ve pasted your code into a trial
project
and everything seems to be working. I’ve deleted the installation select
box, since I haven’t got the installation model. What happens if you are
doing the same?

Here’s what the development.log has put out:

Processing UsersController#register (for 127.0.0.1 at 2006-08-10
10:43:21)
[POST]
Session ID: a49b4781178562dc2c97bf0fc6a32fb6
Parameters: {“commit”=>“Register”, “action”=>“register”,
“controller”=>“users”, “users”=>{“password_confirmation”=>“asdf”,
“password”=>“asdf”, “email”=>“[email protected]”}}
User Columns (0.000000) SHOW FIELDS FROM users
SQL (0.000000) BEGIN
User Load (0.000000) SELECT * FROM users WHERE (users.email = ’
[email protected]’) LIMIT 1
SQL (0.000000) INSERT INTO users (installation_id,
password_hash,
email) VALUES(0, ‘3da541559918a808c2402bba5012f6c60b27661c’, ’
[email protected]’)
SQL (0.047000) COMMIT
Redirected to http://localhost:3003/users
Completed in 0.07800 (12 reqs/sec) | DB: 0.04700 (60%) | 302 Found [
http://localhost/users/register]

Cheers,
Jan

Hey Justin,

is it possible that:

attr_accessible :email, :password

is overriding the (email) column attribute?

You’ve probably added this for a reason, but I’m not sure what this
does for you.
Peak Obsession

Jodi

From original email:

http://pastie.caboo.se/7267

that link shows my schema, controller, model, and view. If you need
anything else, just let me know.

-justin

montyman wrote:

More specifically I am worried about floating point errors. Would it be
more appropriate to use a more statically typed framework (.NET)?

For an example of how to do fixed-point ‘money math’ in Rails check out
this
post:
http://clickablebliss.com/blog/2006/06/14/using_aggregation_in_rails_to_manage_money/

View this message in context:
http://www.nabble.com/ruby-suitable-for-financial-apps--tf2022370.html#a5796971
Sent from the RubyOnRails Users forum at Nabble.com.