aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/table_metadata.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-19 15:09:47 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-19 15:19:43 -0700
commit50a8cdf0e2cff604b0361a370afc8becf2579d94 (patch)
tree5cf602db7410953bbe21ef8e07e2d5670646d721 /activerecord/lib/active_record/table_metadata.rb
parent40887135f6c4e7e9feee03b4dac791ec1d54b3c6 (diff)
downloadrails-50a8cdf0e2cff604b0361a370afc8becf2579d94.tar.gz
rails-50a8cdf0e2cff604b0361a370afc8becf2579d94.tar.bz2
rails-50a8cdf0e2cff604b0361a370afc8becf2579d94.zip
Move `create_binds` over to the `PredicateBuilder`
I'm looking to introduce a `WhereClause` class to handle most of this logic, and this method will eventually move over to there. However, this intermediate refactoring should make that easier to do.
Diffstat (limited to 'activerecord/lib/active_record/table_metadata.rb')
-rw-r--r--activerecord/lib/active_record/table_metadata.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb
index 11e33e8dfe..31a40adb67 100644
--- a/activerecord/lib/active_record/table_metadata.rb
+++ b/activerecord/lib/active_record/table_metadata.rb
@@ -22,6 +22,12 @@ module ActiveRecord
arel_table[column_name]
end
+ def column(column_name)
+ if klass
+ klass.columns_hash[column_name.to_s]
+ end
+ end
+
def associated_with?(association_name)
klass && klass._reflect_on_association(association_name)
end