Adding conditions to every find(:all) call


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:
Look at the example (3rd screen down) at

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)

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