aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/table_metadata.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-02-04 08:02:45 +1030
committerMatthew Draper <matthew@trebex.net>2016-02-04 08:02:45 +1030
commitcdc112e3ea8bd7b5ba787e64f3f8ee3da3e5a64f (patch)
treeaf61cbfd48e5b43dbbc070e7c298a3cf84fc2544 /activerecord/lib/active_record/table_metadata.rb
parent7710d7f432ca776885a346346ccf0971e80b7a34 (diff)
downloadrails-cdc112e3ea8bd7b5ba787e64f3f8ee3da3e5a64f.tar.gz
rails-cdc112e3ea8bd7b5ba787e64f3f8ee3da3e5a64f.tar.bz2
rails-cdc112e3ea8bd7b5ba787e64f3f8ee3da3e5a64f.zip
Defer Arel attribute lookup to the model class
This still isn't as separated as I'd like, but it at least moves most of the burden of alias mapping in one place.
Diffstat (limited to 'activerecord/lib/active_record/table_metadata.rb')
-rw-r--r--activerecord/lib/active_record/table_metadata.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb
index f9bb1cf5e0..0faad48ce3 100644
--- a/activerecord/lib/active_record/table_metadata.rb
+++ b/activerecord/lib/active_record/table_metadata.rb
@@ -22,7 +22,11 @@ module ActiveRecord
end
def arel_attribute(column_name)
- arel_table[column_name]
+ if klass
+ klass.arel_attribute(column_name, arel_table)
+ else
+ arel_table[column_name]
+ end
end
def type(column_name)