Archive for April, 2008

Apr6

Rails Tip: Primary Keys

Rails by default uses a system-generated primary key called “id” for all persisted objects. I personally like this (for the very reasons Dave Thomas outlines in the Rails book on pp. 286-287), but if you don’t, you can change it. Like Dave, I don’t recommend it, but here’s how if you must.
class Friend […]

Continue Reading »

Filed in: Candor Rails

Apr6

Rails Tip: Overriding Defaults in ActiveRecord

Have you ever wish you could tell Rails the name of the table that mapped to your model class?  Perhaps you want a model to represent a legacy table (which could be any table that already exists which is either too painful to recreate or over which you have no control).  Or perhaps you just […]

Continue Reading »

Filed in: Code Rails


Apr6

Rails Tip: Using ActiveRecord Outside Rails

I have found as I’ve been working on my project that Rails has many very useful little features that may not be used all that often but are sometimes needed. As I come across them I hope to note them here in the hopes that they will help someone (myself included) at some point.
Yesterday […]

Continue Reading »

Filed in: Rails



 

Popular Categories

Grails Mac Rails Bible Code Coffee Candor

About

I’m a software engineer by day and even busier by night.  This blog contains my thoughts on subjects from the Bible to lines of code.  I write (and drink) Java, I’m learning Ruby and Rails and I read the King James Bible.  I’m hoping to move the country and buy a farm and stay home with my family to bring them up in the nurture and admonition of the Lord.