Categories: None [Edit]

ScopedProxy

https://rubygems.org/gems/ScopedProxy
== SYNOPSIS: Allows storing scopes as names; that way you can address subsets of your model space by meaningful names. require 'scoped_proxy' # Railsers: You might want to call this in environment.rb 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 This implementation also brings (NEW, SHINY) default proxies. That means you can have a proxy in effect when no other proxy is in effect. class User < ActiveRecord::Base default_proxy :find => { :conditions => 'deleted_at is null' } end User.find(:all) # only finds users that aren't deleted

Total

Ranking: 123,464 of 180,488
Downloads: 4,510

Daily

Ranking: 38,970 of 180,477
Downloads: 0

Depended by

RankDownloadsName

Depends on

RankDownloadsName
1,9578,415,482hoe

Owners

#GravatarHandle
1iconeule