diff options
author | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2010-02-15 00:38:29 +0200 |
---|---|---|
committer | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2010-06-04 22:44:03 +0300 |
commit | a83e6b1b6aa8ee67a47658ed27481e38aa2a62da (patch) | |
tree | 0ac137fc236e64c504130d7133adb7fa24c47563 /activerecord/lib/active_record | |
parent | 464b7f3ddcf5e9b23741862bf8c7a49f61792de3 (diff) | |
download | rails-a83e6b1b6aa8ee67a47658ed27481e38aa2a62da.tar.gz rails-a83e6b1b6aa8ee67a47658ed27481e38aa2a62da.tar.bz2 rails-a83e6b1b6aa8ee67a47658ed27481e38aa2a62da.zip |
downcase table names in aliased_table_name_for and references_eager_loaded_tables? methods (as Oracle quoted table names are in uppercase)
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4e62187449..b6b4085ec0 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -356,13 +356,15 @@ module ActiveRecord end def references_eager_loaded_tables? - joined_tables = (tables_in_string(arel.joins(arel)) + [table.name, table.table_alias]).compact.uniq + # always convert table names to downcase as in Oracle quoted table names are in uppercase + joined_tables = (tables_in_string(arel.joins(arel)) + [table.name, table.table_alias]).compact.map(&:downcase).uniq (tables_in_string(to_sql) - joined_tables).any? end def tables_in_string(string) return [] if string.blank? - string.scan(/([a-zA-Z_][\.\w]+).?\./).flatten.uniq + # always convert table names to downcase as in Oracle quoted table names are in uppercase + string.scan(/([a-zA-Z_][\.\w]+).?\./).flatten.map(&:downcase).uniq end end |