RubyGems Navigation menu

ScopedProxy 1.0.0

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

Gemfile:
= 复制到剪贴板 已复制!

安装:
=

版本列表:

  1. 1.0.0 - December 20, 2007* (9.0 KB)

Runtime 依赖 (1):

hoe >= 1.3.0

业主:

作者:

  • Kaspar Schiess

SHA 256 校验和:

bab771dcd35d1bdf65d54eab39c628cce3a23df5b1a4311d4965389a7d3c1dff

下载总量 4,456

这个版本 4,455

许可:

需要的 Ruby 版本:

链接: