« Programming Erlang is Shipping | Main | Possibly my favorite Rake target »

July 21, 2007

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451c41c69e200e00997b47e8833

Listed below are links to weblogs that reference Advanced Ruby and the Rails Edge:

Comments

Ms. Jen

Dave,

You are not a lost design cause. You have a good eye and, more importantly, good analytical skills.

Looking forward to August.

;o)

p.s. You just might find me in the Nov. Advanced Ruby class...

Tim

Wish I had been at the session! I might have asked why "Agile Web Development with Rails" does not include the term "Stored procedure" anywhere :) I am right now dealing with a fairly hairy legacy database (Sql server no less), and my neophyte ruby status isnt helping me solve some of the relationship issues. nested XREF's, etc. I am almost ready to give up on active record and try rbatis... with all the stored procedures and views in the database, i am having a hard time deciding what to create models for....

Dave Thomas

AWDwR doesn't mention it because DHH doesn't believe in them, and therefore Active Record doesn't really support them. There are database specific hacks, but they're ugly.

The book documents the framework. FWIW, this is something that I personally wish Rails supported.


Dave

Wes Sheldahl

What we've done with our legacy Oracle databases is just treat views like read-only tables, so they get an A/R class. For stored procedures we found some OCI-specific ways to call them, and put that code in particular methods in the A/R model class, so calling it from the rest of the app at least is pretty clean, and the db-specific code stays in the model where it belongs.

I'd suggest first figuring out how to call a SQL Server stored procedure in a plain ruby script using whatever database driver you'll use in Rails, so you're just working with that. Then bring the code into Rails, give it a connection from ActiveRecord (so it uses your rails app's existing connection) and you should have it.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Now in Beta

  • Programming Ruby, 3rd Edition
    Third Edition, Covering Ruby 1.9, now available
My Photo

Pragmatic Stuff

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from pragdave tagged with pragdave_badge. Make your own badge here.

Site Search

  • Google Search

    The web
    PragDave