aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-07-12 21:39:36 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-12 21:39:36 +0100
commit0cfa3574d599f3bc134cd13fa00d8f22809dd67b (patch)
treeb8af1a893ba900c9901c9b1fb7a9a2246aba67c6 /activerecord/test/models
parentef67bd481bacd1ff36a79b7f23f3c08f12f6cbe1 (diff)
parent99cc85bc099a757cdd44e4f5f1be4972ab124e0d (diff)
downloadrails-0cfa3574d599f3bc134cd13fa00d8f22809dd67b.tar.gz
rails-0cfa3574d599f3bc134cd13fa00d8f22809dd67b.tar.bz2
rails-0cfa3574d599f3bc134cd13fa00d8f22809dd67b.zip
Merge commit 'mainstream/master'
Conflicts: actionpack/lib/action_controller/base.rb railties/lib/rails_generator/commands.rb
Diffstat (limited to 'activerecord/test/models')
-rwxr-xr-xactiverecord/test/models/company.rb3
-rwxr-xr-xactiverecord/test/models/topic.rb2
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index 9fa810ac68..e6aa810146 100755
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -46,11 +46,14 @@ class Firm < Company
has_many :clients_using_finder_sql, :class_name => "Client", :finder_sql => 'SELECT * FROM companies WHERE 1=1'
has_many :plain_clients, :class_name => 'Client'
has_many :readonly_clients, :class_name => 'Client', :readonly => true
+ has_many :clients_using_primary_key, :class_name => 'Client',
+ :primary_key => 'name', :foreign_key => 'firm_name'
has_one :account, :foreign_key => "firm_id", :dependent => :destroy, :validate => true
has_one :unvalidated_account, :foreign_key => "firm_id", :class_name => 'Account', :validate => false
has_one :account_with_select, :foreign_key => "firm_id", :select => "id, firm_id", :class_name=>'Account'
has_one :readonly_account, :foreign_key => "firm_id", :class_name => "Account", :readonly => true
+ has_one :account_using_primary_key, :primary_key => "firm_id", :class_name => "Account"
end
class DependentFirm < Company
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 47b2eec938..39ca1bf42a 100755
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -4,6 +4,8 @@ class Topic < ActiveRecord::Base
{ :conditions => ['written_on < ?', time] }
}
named_scope :approved, :conditions => {:approved => true}
+ named_scope :by_lifo, :conditions => {:author_name => 'lifo'}
+
named_scope :approved_as_hash_condition, :conditions => {:topics => {:approved => true}}
named_scope 'approved_as_string', :conditions => {:approved => true}
named_scope :replied, :conditions => ['replies_count > 0']