aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines/sql
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/engines/sql')
-rw-r--r--lib/arel/engines/sql/relations/table.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/arel/engines/sql/relations/table.rb b/lib/arel/engines/sql/relations/table.rb
index dd9000d660..b31df7a6d0 100644
--- a/lib/arel/engines/sql/relations/table.rb
+++ b/lib/arel/engines/sql/relations/table.rb
@@ -82,6 +82,15 @@ module Arel
@columns = nil
@attributes = Header.new([])
end
+
+ private
+ def matching_attributes
+ @matching_attributes ||= Hash[attributes.map { |a| [a.root, true] }]
+ end
+
+ def has_attribute?(attribute)
+ matching_attributes.key? attribute.root
+ end
end
end