Quoting Learn by Doing <rails-mailing-list@andreas-s.net>:
I have a problem running find using composite primary keys. I have the following models:
Code : - fold - unfold
1. class Stat < ActiveRecord::Base 2. set_primary_keys :user_id, :score_aspect 3. belongs_to :user
Code : - fold - unfold
1. class User < ActiveRecord::Base 2. has_many :stats
Stat.find runs fine when it can find a stat. But it returns error instead of "nil", when it cannot find a stat.
This is normal behavior, when calling find with a non-existant primary key, it throws an exception, ActiveRecord::RecordNotFound. Try it on one of your other classes, e.g., User.find(99999999).
HTH, Jeffrey