diff options
author | miloops <miloops@gmail.com> | 2008-09-11 17:41:55 -0300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-11 22:51:57 +0200 |
commit | a37c5ae961366e3d693991b51d0830d40ae37e08 (patch) | |
tree | 0fa9d5de486f5d2fc317676df182d34040a8da1a /activerecord/test/models | |
parent | 095ad690f3fb6df4e89446dd40e03cf2c204e42a (diff) | |
download | rails-a37c5ae961366e3d693991b51d0830d40ae37e08.tar.gz rails-a37c5ae961366e3d693991b51d0830d40ae37e08.tar.bz2 rails-a37c5ae961366e3d693991b51d0830d40ae37e08.zip |
Improve test coverage when using the group option in find, has_many or has_and_belongs_to_many.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/category.rb | 3 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/category.rb b/activerecord/test/models/category.rb index 1660c61682..a06dd78011 100644 --- a/activerecord/test/models/category.rb +++ b/activerecord/test/models/category.rb @@ -13,6 +13,9 @@ class Category < ActiveRecord::Base has_and_belongs_to_many :post_with_conditions, :class_name => 'Post', :conditions => { :title => 'Yet Another Testing Title' } + + has_and_belongs_to_many :posts_gruoped_by_title, :class_name => "Post", :group => "title" + def self.what_are_you 'a category...' end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index cd435948a1..1abf3f3918 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -55,6 +55,8 @@ class Firm < Company 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_many :clients_grouped_by_firm_id, :class_name => "Client", :group => "firm_id" + has_many :clients_grouped_by_name, :class_name => "Client", :group => "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 |