diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-04 15:25:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-04 15:25:20 -0700 |
commit | e7d860c6bed99b0d44680097fcc1cfd7c1fa07ef (patch) | |
tree | a7e84bcebefa13e8d45911f9d2e16f225bd24105 /activerecord/lib/active_record/connection_adapters | |
parent | d8135eb452bfb956e093c61cf12adb9b0da6e28b (diff) | |
download | rails-e7d860c6bed99b0d44680097fcc1cfd7c1fa07ef.tar.gz rails-e7d860c6bed99b0d44680097fcc1cfd7c1fa07ef.tar.bz2 rails-e7d860c6bed99b0d44680097fcc1cfd7c1fa07ef.zip |
create fewer objects, call fewer methods in extract_pg_identifier_from_name
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 95b6a8137d..5f14284615 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1017,11 +1017,11 @@ module ActiveRecord end def extract_pg_identifier_from_name(name) - match_data = name[0,1] == '"' ? name.match(/\"([^\"]+)\"/) : name.match(/([^\.]+)/) + match_data = name.start_with?('"') ? name.match(/\"([^\"]+)\"/) : name.match(/([^\.]+)/) if match_data - rest = name[match_data[0].length..-1] - rest = rest[1..-1] if rest[0,1] == "." + rest = name[match_data[0].length, name.length] + rest = rest[1, rest.length] if rest.start_with? "." [match_data[1], (rest.length > 0 ? rest : nil)] end end |