aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/utilities/externalization.rb
blob: 13758ccec9802963cde50fa1720db3143325d55a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Arel
  class Externalization < Compound
    attributes :relation
    deriving :initialize, :==

    def wheres
      []
    end

    def attributes
      @attributes ||= relation.attributes.collect { |a| a.to_attribute(self) }
    end
  end

  class Relation
    def externalize
      @externalized ||= externalizable?? Externalization.new(self) : self
    end

    def externalizable?
      false
    end
  end
end