Forum: Ruby on Rails RoR and stored procedures

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
97e0ab2f199cf00cd5246aa649c21f24?d=identicon&s=25 wintermute (Guest)
on 2007-05-07 05:58
Hi all,

I was wondering about what is the general consensus regarding using SQL
stored procedures in RoR. Based on the fact that stored procedures are
not mentioned in most (any) of the RoR manuals I read, I can conclude
their usage is discouraged.

Is there any particular reason against using SPs?

6edd67c92a1dab5eb23fed79f3c18564?d=identicon&s=25 DHH (Guest)
on 2007-05-07 06:38
(Received via mailing list)
Stored procedures put logic into the database. A place where it's hard
to test, hard to version control, hard to access, and typically
written in a low-level language that's a pain to deal with. Every now
and then, you might find yourself in a situation where they're
actually worth it for performance reasons. Just like some times it
makes sense to write a piece of your application in C.

Treat stored procedures like C: Avoid it like the plague until it's
your only hope for survival.
F3dc06f587d1ff4c7366b102bfda9204?d=identicon&s=25 David Mitchell (Guest)
on 2007-05-07 06:41
(Received via mailing list)
I think, in general, people using Rails prefer to have all their code
within their Rails app rather than use stored procedures.

I use stored procs all the time with Rails, because I prefer to have
the database "protect itself" from bad data, rather than rely on the
application/s to do it for me.  That's the big issue for me, although
I also use stored procs with Rails for other purposes.

It seems to be as much individual preference, and different
experiences, as anything else - I don't believe either approach is
"better" than the other.


Dave M.
This topic is locked and can not be replied to.