diff options
Diffstat (limited to 'lib/arel/relations/utilities/compound.rb')
-rw-r--r-- | lib/arel/relations/utilities/compound.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/arel/relations/utilities/compound.rb b/lib/arel/relations/utilities/compound.rb new file mode 100644 index 0000000000..a77099e0de --- /dev/null +++ b/lib/arel/relations/utilities/compound.rb @@ -0,0 +1,26 @@ +module Arel + class Compound < Relation + attr_reader :relation + hash_on :relation + delegate :joins, :wheres, :join?, :inserts, :taken, + :skipped, :name, :aggregation?, :column_for, + :engine, :table, :table_sql, + :to => :relation + + def attributes + @attributes ||= relation.attributes.collect { |a| a.bind(self) } + end + + def wheres + @wheres ||= relation.wheres.collect { |w| w.bind(self) } + end + + def groupings + @groupings ||= relation.groupings.collect { |g| g.bind(self) } + end + + def orders + @orders ||= relation.orders.collect { |o| o.bind(self) } + end + end +end
\ No newline at end of file |