From 9567f8e4e87f95929f331a2d5eb35bce952eac86 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Sat, 19 Apr 2008 20:40:47 -0700 Subject: [PATCH] - new todo items - alias to_sql to to_s - added column_for to join (untested) --- doc/TODO | 7 ++++++- lib/arel/predicates.rb | 1 + lib/arel/relations/join.rb | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/TODO b/doc/TODO index 435684d77b..fc18af28b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,10 +1,14 @@ todo: +- active record query adapter +- audit active record quoting - incorporate linq functionality/terminology - then_by (ordering) - reverse - any/all - where -- fix complex joining cases: +- limit clauses with left outer joins ? + - see add_limited_ids_condition + - select_limited_ids_list - extract adapters - cache expiry on write - rewrite of arecord querycache test in light of this @@ -61,6 +65,7 @@ done: - test Value, in particular bind. - test blank checks in relation.rb - rename active_relation to arel +- fix complex joining cases: icebox: - #bind in Attribute and Expression should be doing a descend? diff --git a/lib/arel/predicates.rb b/lib/arel/predicates.rb index ccaec1ad93..7faaebfc17 100644 --- a/lib/arel/predicates.rb +++ b/lib/arel/predicates.rb @@ -23,6 +23,7 @@ module Arel def to_sql(formatter = nil) "#{operand1.to_sql} #{predicate_sql} #{operand1.format(operand2)}" end + alias_method :to_s, :to_sql end class Equality < Binary diff --git a/lib/arel/relations/join.rb b/lib/arel/relations/join.rb index fb51ea0260..d5ec9d43bd 100644 --- a/lib/arel/relations/join.rb +++ b/lib/arel/relations/join.rb @@ -37,6 +37,11 @@ module Arel end end + # TESTME: Not sure which scenario needs this method, was driven by failing tests in ActiveRecord + def column_for(attribute) + (relation1[attribute] || relation2[attribute]).column + end + def joins this_join = [ join_sql,