[ANN] Scoped Proxy 1.0

== What?

  class User < ActiveRecord::Base
    scoped_proxy :role do |role|
      {
        :find => { :conditions => ['role = ?', role] }
      }
    end
    scoped_proxy :deleted, :find => {
      :conditions => 'deleted_at is not null'
    }
  end

  admins = User.role('admin')
  admins.count # => 12
  admins.find(:all) # => [ ... ]

  User.deleted.count # => a number

== More!

Swiss.rb is a small project for a small country. Here we'll release all sorts of small projects that we would not release otherwise - partly issued by the local ruby user group, partly things we develop for applications.

ScopedProxy is a small plugin for ActiveRecord that allows you to name a set of sql conditions (like role('admin')) and then access it through that name. Really the logical consequence of with_scope!

This latest version has default proxies that take effect when no other proxy is in effect. This is quite useful for always restricting search, not just when using a named proxy.

== Get your copy

http://rubyforge.org/frs/?group_id=5130

or maybe

gem install ScopedProxy

== Earlier Releases

Were on my old blog neotrivium.com - now we have an official project home (http://rubyforge.org/projects/swissrb), and one that isn't so enterprisey :wink: Please let us know what you think! If you have something to contribute - please get in touch. Happy Hacking!

best greetings

Kaspar Schiess

···

--
(oh & please visit our new blog at labs.restorm.com)