Hello and welcome to the restorm technical blog. It is here that we post about what is happening in our labs, what keeps us busy and why X doesn't work. Read more about us on the about page.

ScopedProxy 1.0

Dec 21, 2007 | 0 comments

We’re proud to announce our first software release: Scoped Proxy. Here’s what it does:

require 'scoped_proxy'
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

Those of you who’ve read our old blog (neotrivium.com) will know the scoped proxy as a single file drop in plugin. On public demand I’ve gem-ified it. To install, simply type:

sudo gem install ScopedProxy

Easy as that. Please let me know what you think!

(Update: Here’s the link to our rubyforge project: swissrb)

yours truly, kaspar