diff options
Diffstat (limited to 'lib/active_relation/relations/projection.rb')
-rw-r--r-- | lib/active_relation/relations/projection.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/active_relation/relations/projection.rb b/lib/active_relation/relations/projection.rb new file mode 100644 index 0000000000..b30c76898d --- /dev/null +++ b/lib/active_relation/relations/projection.rb @@ -0,0 +1,19 @@ +module ActiveRelation + module Relations + class Projection < Compound + attr_reader :relation, :attributes + + def initialize(relation, *attributes) + @relation, @attributes = relation, attributes + end + + def ==(other) + relation == other.relation and attributes.eql?(other.attributes) + end + + def qualify + Projection.new(relation.qualify, *attributes.collect(&:qualify)) + end + end + end +end
\ No newline at end of file |