aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorEloy Duran <eloy.de.enige@gmail.com>2009-07-11 17:52:13 +0200
committerEloy Duran <eloy.de.enige@gmail.com>2009-09-12 15:53:15 +0200
commit6cc0b9638fbb6ede3c46b51d7dab17881416014c (patch)
treefbfa46d9165f5c60c24939ef53dfecf28db23ea9 /activerecord/test/models
parent1b78e9bba3bd39c4669ff6c640b7df069185c22c (diff)
downloadrails-6cc0b9638fbb6ede3c46b51d7dab17881416014c.tar.gz
rails-6cc0b9638fbb6ede3c46b51d7dab17881416014c.tar.bz2
rails-6cc0b9638fbb6ede3c46b51d7dab17881416014c.zip
Explicitely setting `autosave => false' should override new_record autosaving. [#2214 state:resolved]
Original author is Jacob.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/company.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index 9242c209ea..d69152ec34 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -79,6 +79,10 @@ class Firm < Company
# Oracle tests were failing because of that as the second fixture was selected
has_one :account_using_primary_key, :primary_key => "firm_id", :class_name => "Account", :order => "id"
has_one :deletable_account, :foreign_key => "firm_id", :class_name => "Account", :dependent => :delete
+
+ has_one :unautosaved_account, :foreign_key => "firm_id", :class_name => 'Account', :autosave => false
+ has_many :accounts
+ has_many :unautosaved_accounts, :foreign_key => "firm_id", :class_name => 'Account', :autosave => false
end
class DependentFirm < Company
@@ -149,6 +153,7 @@ end
class Account < ActiveRecord::Base
belongs_to :firm
+ belongs_to :unautosaved_firm, :foreign_key => "firm_id", :class_name => "Firm", :autosave => false
def self.destroyed_account_ids
@destroyed_account_ids ||= Hash.new { |h,k| h[k] = [] }