diff options
author | Matthew Draper <matthew@trebex.net> | 2016-02-04 08:02:45 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-02-04 08:02:45 +1030 |
commit | cdc112e3ea8bd7b5ba787e64f3f8ee3da3e5a64f (patch) | |
tree | af61cbfd48e5b43dbbc070e7c298a3cf84fc2544 /activerecord/lib/active_record/core.rb | |
parent | 7710d7f432ca776885a346346ccf0971e80b7a34 (diff) | |
download | rails-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/core.rb')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 475a298467..aa8f22ce42 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -256,6 +256,11 @@ module ActiveRecord end end + def arel_attribute(name, table) # :nodoc: + name = attribute_alias(name) if attribute_alias?(name) + table[name] + end + def predicate_builder # :nodoc: @predicate_builder ||= PredicateBuilder.new(table_metadata) end |