Extending ActiveRecord Extensions


#1

Let’s say I’ve got a table of people. Each person is either male or
female and single or not single. I can get methods like:

group.people.male
group.people.female
group.people.single

By using extensions a la:

class Group < ActiveRecord::Base
has_many :people do
def single
find :all, :conditions=>{:single=>true}
end
end

But what if I wanted methods like:

group.people.female.single

Is there a way to extend the extensions at all? It seems like this
functionality would be very helpful to encapsulate everything so you
don’t end up with methods like

group.people.female_and_single
group.people.male_and_not_single

Thoughts?