diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-04-20 18:12:40 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-04-20 18:12:40 +0100 |
commit | de0ea3866370ec61581f910cf393a3cc97eba32f (patch) | |
tree | b32efb2bea337b96c875ac5e78c39760c5e663bf /activerecord/test/models/company.rb | |
parent | 489abfd3b23f3c4b3de86aeb3bde3970771c001b (diff) | |
download | rails-de0ea3866370ec61581f910cf393a3cc97eba32f.tar.gz rails-de0ea3866370ec61581f910cf393a3cc97eba32f.tar.bz2 rails-de0ea3866370ec61581f910cf393a3cc97eba32f.zip |
Ensure :dependent => :delete_all works for association with hash conditions
Diffstat (limited to 'activerecord/test/models/company.rb')
-rw-r--r-- | activerecord/test/models/company.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 02a775f9ef..eb68153bbe 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -78,13 +78,6 @@ class DependentFirm < Company has_many :companies, :foreign_key => 'client_of', :order => "id", :dependent => :nullify end -class ExclusivelyDependentFirm < Company - has_one :account, :foreign_key => "firm_id", :dependent => :delete - has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'" - has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.'] - has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'} -end - class Client < Company belongs_to :firm, :foreign_key => "client_of" belongs_to :firm_with_basic_id, :class_name => "Firm", :foreign_key => "firm_id" @@ -125,6 +118,12 @@ class Client < Company end end +class ExclusivelyDependentFirm < Company + has_one :account, :foreign_key => "firm_id", :dependent => :delete + has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'" + has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.'] + has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'} +end class SpecialClient < Client end |