aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-06-23 17:38:31 -0300
committerEmilio Tagua <miloops@gmail.com>2009-06-23 17:38:31 -0300
commit02a723f7b5f30b00fc77bc85162598f707c7b682 (patch)
treef3761e591165cac781455b7fbf27b1ba316a3e90 /activerecord/lib/active_record/connection_adapters
parentbc899fd3a37fae7e0024e8f0439f204818aeafd7 (diff)
downloadrails-02a723f7b5f30b00fc77bc85162598f707c7b682.tar.gz
rails-02a723f7b5f30b00fc77bc85162598f707c7b682.tar.bz2
rails-02a723f7b5f30b00fc77bc85162598f707c7b682.zip
Arel now buils SQL queries for associations. Removed old code and
updated Arel version to support this.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb14
2 files changed, 0 insertions, 20 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index ff63ea3a2e..2f01a303e5 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -403,12 +403,6 @@ module ActiveRecord
"DISTINCT #{columns}"
end
- # ORDER BY clause for the passed order option.
- # PostgreSQL overrides this due to its stricter standards compliance.
- def add_order_by_for_association_limiting!(sql, options)
- sql << " ORDER BY #{options[:order]}"
- end
-
# Adds timestamps (created_at and updated_at) columns to the named table.
# ===== Examples
# add_timestamps(:suppliers)
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 90a90a0a9b..6b230787c3 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -911,20 +911,6 @@ module ActiveRecord
sql << order_columns * ', '
end
- # Returns an ORDER BY clause for the passed order option.
- #
- # PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this
- # by wrapping the +sql+ string as a sub-select and ordering in that query.
- def add_order_by_for_association_limiting!(sql, options) #:nodoc:
- return sql if options[:order].blank?
-
- order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)
- order.map! { |s| 'DESC' if s =~ /\bdesc$/i }
- order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{s}" }.join(', ')
-
- sql.replace "SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}"
- end
-
protected
# Returns the version of the connected PostgreSQL version.
def postgresql_version