aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@aura-online.co.uk>2010-06-12 11:55:31 +0100
committerJosé Valim <jose.valim@gmail.com>2010-06-20 00:32:06 +0200
commitf664c57fe854c230d25c448b941569b81860fa79 (patch)
treeabec332dc7b0981c9ee43090b7aacbe1827fbdf1 /activerecord/test/models
parent98a5188f518b1e8cfa9d7aa59856e5b32985eb46 (diff)
downloadrails-f664c57fe854c230d25c448b941569b81860fa79.tar.gz
rails-f664c57fe854c230d25c448b941569b81860fa79.tar.bz2
rails-f664c57fe854c230d25c448b941569b81860fa79.zip
Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. Reapplied from before but now allows already-saved records to be refreshed.
[#4830 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/pirate.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb
index f1dbe32c6e..d89c8cf381 100644
--- a/activerecord/test/models/pirate.rb
+++ b/activerecord/test/models/pirate.rb
@@ -1,7 +1,7 @@
class Pirate < ActiveRecord::Base
belongs_to :parrot, :validate => true
belongs_to :non_validated_parrot, :class_name => 'Parrot'
- has_and_belongs_to_many :parrots, :validate => true
+ has_and_belongs_to_many :parrots, :validate => true, :order => 'parrots.id ASC'
has_and_belongs_to_many :non_validated_parrots, :class_name => 'Parrot'
has_and_belongs_to_many :parrots_with_method_callbacks, :class_name => "Parrot",
:before_add => :log_before_add,
@@ -21,7 +21,7 @@ class Pirate < ActiveRecord::Base
has_one :ship
has_one :update_only_ship, :class_name => 'Ship'
has_one :non_validated_ship, :class_name => 'Ship'
- has_many :birds
+ has_many :birds, :order => 'birds.id ASC'
has_many :birds_with_method_callbacks, :class_name => "Bird",
:before_add => :log_before_add,
:after_add => :log_after_add,