aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-18 23:39:19 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-18 23:40:42 +0530
commit9e7ec2a9f13aa52cdf07cf9308e8031548dcddc0 (patch)
treebd8e438ff20486cccb23f96fc6c37e044b07132d /activerecord/test/models
parent3c4186b366a14042a6ea6cc3432634d41986d1e2 (diff)
downloadrails-9e7ec2a9f13aa52cdf07cf9308e8031548dcddc0.tar.gz
rails-9e7ec2a9f13aa52cdf07cf9308e8031548dcddc0.tar.bz2
rails-9e7ec2a9f13aa52cdf07cf9308e8031548dcddc0.zip
Simplify calculation scope building. Remove :order from associations as it is troublesome w/ calculation methods using postgresql.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/company.rb8
-rw-r--r--activerecord/test/models/post.rb2
2 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index 7e93fda1eb..df5fd10b6b 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -45,7 +45,7 @@ class Firm < Company
has_many :unvalidated_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :validate => false
has_many :dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :destroy
has_many :exclusively_dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all
- has_many :limited_clients, :class_name => "Client", :order => "id", :limit => 1
+ has_many :limited_clients, :class_name => "Client", :limit => 1
has_many :clients_like_ms, :conditions => "name = 'Microsoft'", :class_name => "Client", :order => "id"
has_many :clients_with_interpolated_conditions, :class_name => "Client", :conditions => 'rating > #{rating}'
has_many :clients_like_ms_with_hash_conditions, :conditions => { :name => 'Microsoft' }, :class_name => "Client", :order => "id"
@@ -91,10 +91,8 @@ class Firm < Company
end
class DependentFirm < Company
- # added order by id as in fixtures there are two accounts for Rails Core
- # Oracle tests were failing because of that as the second fixture was selected
- has_one :account, :foreign_key => "firm_id", :dependent => :nullify, :order => "id"
- has_many :companies, :foreign_key => 'client_of', :order => "id", :dependent => :nullify
+ has_one :account, :foreign_key => "firm_id", :dependent => :nullify
+ has_many :companies, :foreign_key => 'client_of', :dependent => :nullify
end
class Client < Company
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 939df7549b..f48b35486c 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -25,7 +25,7 @@ class Post < ActiveRecord::Base
{ :joins => :comments, :conditions => {:comments => {:post_id => post_id} } }
}
- has_many :comments, :order => "body" do
+ has_many :comments do
def find_most_recent
find(:first, :order => "id DESC")
end