From: Gabriele Marrone Date: 2006-11-21T22:22:37+09:00 Subject: Re: Active Record out of rails: still assumes id? On 21/nov/06, at 14:12, Chris Gallagher wrote: > This is clearly due to the fact that I dont have any id fields in my > database as i thought that active record would do something similar to > rails and that i wouldnt have to define them? Obviously this isnt > quite > the case? I guess your table will have a key, anyway. You just have to tell ActiveRecord what is the key column, as in: class Person < ActiveRecord::Base set_primary_key :full_name # overrides id with full_name end Some times you will need a composite primary key, but ActiveRecord doesn't support them by default. If you need them, however, you can install the composite_primary_keys gem (http:// compositekeys.rubyforge.org/) and then do something like this: class Person < ActiveRecord::Base set_primary_keys :first_name, :last_name end -- Gabriele Marrone