This is a tale about Ruby On Rails, custom stored procedures for MySql 5 and how Rails 1.2.3 is not only opinionated against stored procedures but also actually incompatible with creating and sometimes calling (mysql) stored procedures. The tales does not end with a truly happy ending but some “hacks” are mentioned that I have found useful.
Background
The rails framework developers, being of the opinion that
complexity is best located in the code and not in the database,
does not advocate using stored procedures as a abstraction layer
between the database and the application. Instead dynamic sql
generated from RoR code is used. For typical application
databases, this approach works very well indeed.
Examples where the traditional rails way of database thinking sometimes fails short are projects …
[Read more]