aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/attributes/attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/attributes/attribute.rb')
-rw-r--r--lib/arel/algebra/attributes/attribute.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb
index 9206b228c8..8a7993f284 100644
--- a/lib/arel/algebra/attributes/attribute.rb
+++ b/lib/arel/algebra/attributes/attribute.rb
@@ -270,5 +270,17 @@ module Arel
end
end
include Types
+
+ def column
+ original_relation.column_for(self)
+ end
+
+ def format(object)
+ object.to_sql(Sql::Attribute.new(self))
+ end
+
+ def to_sql(formatter = Sql::WhereCondition.new(relation))
+ formatter.attribute self
+ end
end
end