This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon Dec 29 08:04:16 -0800 2008 | |
| |
README.rdoc | Fri Jan 02 12:35:11 -0800 2009 | |
| |
Rakefile | Mon Dec 29 15:14:51 -0800 2008 | |
| |
init.rb | Fri Jan 02 04:46:11 -0800 2009 | |
| |
lib/ | Fri Jan 02 04:46:11 -0800 2009 | |
| |
test/ | Fri Jan 02 02:07:38 -0800 2009 |
README.rdoc
ColumnScope
Selecting only specified columns can safe you resources and processing time.
I wrote this plugin because I do this all the time and I don’t want to cripple my code anymore.
ColumnScope is build on top of NamedScope so it only works with Ruby on Rails 2.1+.
Examples:
Item.selects(:name).proxy_options[:select] # => '"items"."name"' content = 'Foo Bar Baz' Item.create :name => 'foo', :value => 1, :content => content Item.create :name => 'bar', :value => 2, :content => content Item.create :name => 'baz', :value => 3, :content => content Item.selects(:name).values.all :order => 'id' # => %w[foo bar baz] # use a shortcut to retrieve values of name and content distinct Item.select_first :distinct_name__content # => ['foo', content] # without shortcut Item.selects(:name, :content).uniq!.values.first # => ['foo', content] # reject named columns in scope :a_named_scope and select only the values Item.a_named_scope.rejects(:content).values.all # => [[1, 'foo', 1], ...]
See test/column_scope_test.rb for more examples.
Install (rails):
$ script/plugin install git://github.com/boof/column_scope.git # alternativly: $ cd vendor/plugins $ git clone git://github.com/boof/column_scope.git
Copyright © 2008 Florian Aßmann, released under the MIT license







