From 9567f8e4e87f95929f331a2d5eb35bce952eac86 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Sat, 19 Apr 2008 20:40:47 -0700 Subject: - new todo items - alias to_sql to to_s - added column_for to join (untested) --- lib/arel/predicates.rb | 1 + lib/arel/relations/join.rb | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'lib') 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, -- cgit v1.2.3