"find_all_by<associated class>" ?

If an "Learningobject" belongs to a "Kind", and a kind has many
learningobjects, linked in the usual way where a learningobject has a
kind_id field, can i set up the method_missing stuff so that i can say

Learningobject.find_all_by_kind("some_value")

?

In a DB i'm working on, previously each learningobect simply had a
string to represent their kind. I changed this to reference a new
"kinds" table, but now i'm having problems with "paginate_by_kind",
which calls "find_all_by_kind", creating the problem above. I've
already created get and set methods for kind in learningobject.

thanks! max

Max Williams wrote:

If an "Learningobject" belongs to a "Kind", and a kind has many
learningobjects, linked in the usual way where a learningobject has a
kind_id field, can i set up the method_missing stuff so that i can say

Learningobject.find_all_by_kind("some_value")

?

In a DB i'm working on, previously each learningobect simply had a
string to represent their kind. I changed this to reference a new
"kinds" table, but now i'm having problems with "paginate_by_kind",
which calls "find_all_by_kind", creating the problem above. I've
already created get and set methods for kind in learningobject.

thanks! max

Never mind, i worked it out, it's pretty obvious really (usually writing
out these questions makes the answer pop into my head a few minutes
after posting, sorry!). I can just call
  Learningobject.find_all_by_kind_id
instead. doh.

thanks for reading anyway.