boof / column_scope

Ruby on Rails plugin based on NamedScope to select single columns without crippling your code.

This URL has Read+Write access

column_scope / init.rb
100644 17 lines (11 sloc) 0.411 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require "#{ File.dirname __FILE__ }/lib/active_record/named_scope/column_scope"
 
module ActiveRecord
 
  Base.extend NamedScope::ColumnScope::ScopeMethods
  # Overwrite <tt>Base.values</tt> to directly call <tt>column_names</p>.
  def Base.values
    NamedScope::ColumnScope::ValueExtractor.new self, column_names
  end
 
  module NamedScope
    Scope.class_eval { include ColumnScope::ScopeMethods }
  end
 
end