I have 3 models: Category, Account, and SubAccount   

The relations are:   

Accounts has\_many :sub\_accounts   

I wanted to get a list of all Categories that are not used by a given account.
My method in the Category model currently looks like:

```
class Category < ActiveRecord::Base  
  def self.not_used_by(account)
      Category.find_by_sql("select * from categories where id not in(select category_id from sub_accounts where account_id = #{account.id})")
  end
end

```

My question is, is there a cleaner alternative than using SQL?

*NB. I am currently using Rails 3(beta)*