aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/company.rb
diff options
context:
space:
mode:
authorLuciano G Panaro <contact@decodeuri.com>2009-09-26 10:33:50 -0300
committerMichael Koziarski <michael@koziarski.com>2009-09-28 14:50:33 +1300
commit4168f876238982d0d584006f50188071928a8b7f (patch)
tree93e22b323a8f3bf25c5e67697a347e1fb958b0a0 /activerecord/test/models/company.rb
parentd48ebeade2d907573e3fb086495b57b10115066c (diff)
downloadrails-4168f876238982d0d584006f50188071928a8b7f.tar.gz
rails-4168f876238982d0d584006f50188071928a8b7f.tar.bz2
rails-4168f876238982d0d584006f50188071928a8b7f.zip
Make has_one with :conditions hash scope build or creation of the associated object with those conditions
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#3088 state:committed]
Diffstat (limited to 'activerecord/test/models/company.rb')
-rw-r--r--activerecord/test/models/company.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index b1a3930e4e..469f5399ae 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -81,6 +81,8 @@ class Firm < Company
has_one :account_using_foreign_and_primary_keys, :foreign_key => "firm_name", :primary_key => "name", :class_name => "Account"
has_one :deletable_account, :foreign_key => "firm_id", :class_name => "Account", :dependent => :delete
+ has_one :account_limit_500_with_hash_conditions, :foreign_key => "firm_id", :class_name => "Account", :conditions => { :credit_limit => 500 }
+
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