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.


Code :   - fold - unfold

   1. >> Stat.find(user, "valid_aspect")
   2. => #<Stat id: 335580687, user_id: 1000, score_aspect:
"valid_aspect" . . .>
   3.
   4.
   5. >> Stat.find(user, "dfsdf")
   6. ActiveRecord::RecordNotFound: Couldn't find all Stats with IDs
([[#<User id: 1000, . . . "dfsdf"]])`stats`.`user_id`=1000 AND
`stats`.`score_aspect`='dfsdf'
   7.   from
/opt/local/lib/ruby/gems/1.8/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/base.rb:296:in
`find_from_ids'
   8.   from
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:616:in
`find'
   9.   from (irb):41

I am using http://compositekeys.rubyforge.org/  .  Please help.  Thanks.
Developing with Rails 2.3.2; Ruby 1.8.7 (2009-04-08 patchlevel 160)
[powerpc-darwin9]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to