Briefly, you would use scope_out like so:
class Thing < ActiveRecord::Base
scope_out :active, value => true
end
This simple declaration defines three class methods for you, like so:
def Thing.with_active
with_scope :find => {:conditions => ['active => ?', true]} do
yield
end
end
def Thing.find_active(*args)
with_active {find(*args)}
end
def Thing.calculate_active(*args)
with_active {calculate(*args)}
end
There are 2 basic syntaxes for using scope_out. In the first, you may omit :field if the name of the field is the same as the name of the scope. :value can be a boolean, integer, or string. :conditions can take any of rails' normal condition syntaxes.
scope_out(:scope_name, :field => 'field_name', :value => value)
scope_out(:scope_name, :conditions => ['field => ?', value])
So there you have it, pure syntactic sugar. 100% meta. Enjoy!