Adding conditions to every find(:all) call

Alex

Some people will disagree, but I feel the query scoping you are looking is better located in the controller than in the model.

There is a plugin that seems to solve this very problem:     meantime_filter Look at the example (3rd screen down) at     http://roman2k.free.fr/rails/meantime_filter/0.1.1/rdoc/

It let's you write code like this :

   class PostsController < ApplicationController       before_filter :authenticate       wrap_filter :scope_posts_to_user

      # Displays the posts of the logged in user.       def show         @posts = Post.find(:all)       end       ...

Personally, I don't feel enough pain to use this way, so I'd write it the 'old' way ,along:

    my_bucket = Bucket.find(:conditions => ...)     all_my_folders = my_bucket.folders

Alain