diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-27 10:27:08 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-27 10:27:08 -0800 |
commit | 699e460be2ae9ab419ff5ce17f7ebbbd63b4ef47 (patch) | |
tree | d599e974c7bb108252f6437fd695dcbeffb40399 /activerecord/lib/active_record/connection_adapters | |
parent | a19dd29e554ee9578bb7f95a35bc5712bb06ab4d (diff) | |
parent | 404b73bce1f9347ca05b1496db8fc64438d66bd2 (diff) | |
download | rails-699e460be2ae9ab419ff5ce17f7ebbbd63b4ef47.tar.gz rails-699e460be2ae9ab419ff5ce17f7ebbbd63b4ef47.tar.bz2 rails-699e460be2ae9ab419ff5ce17f7ebbbd63b4ef47.zip |
Merge pull request #5168 from kennyj/fix_5152
[PostgreSQL] Remove NULLS FIRST/LAST. Closes #5152
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index c675b64a26..d2126a3e19 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1189,7 +1189,7 @@ module ActiveRecord # Construct a clean list of column names from the ORDER BY clause, removing # any ASC/DESC modifiers - order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*/i, '') } + order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') } order_columns.delete_if { |c| c.blank? } order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" } |