aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-01 05:31:56 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-01 05:31:56 +0000
commitb1257d96b7b2482fc7811e5dc12d71c9fa091d10 (patch)
tree244c5033c18cf4de0745f5d01def696accd618bc /activerecord/test/fixtures
parent9c99be88b2806600f768b74bcfff1bc93de8c5ef (diff)
downloadrails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.tar.gz
rails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.tar.bz2
rails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.zip
has_many :through conditions are sanitized by the associating class. Closes #5971.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/author.rb2
-rw-r--r--activerecord/test/fixtures/project.rb1
2 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb
index a9102a269a..1c49b90fe5 100644
--- a/activerecord/test/fixtures/author.rb
+++ b/activerecord/test/fixtures/author.rb
@@ -37,6 +37,8 @@ class Author < ActiveRecord::Base
has_many :categorizations
has_many :categories, :through => :categorizations
+ has_many :categories_like_general, :through => :categorizations, :source => :category, :class_name => 'Category', :conditions => { :name => 'General' }
+
has_many :categorized_posts, :through => :categorizations, :source => :post
has_many :unique_categorized_posts, :through => :categorizations, :source => :post, :uniq => true
diff --git a/activerecord/test/fixtures/project.rb b/activerecord/test/fixtures/project.rb
index 4d4e0e127a..2079dc9b58 100644
--- a/activerecord/test/fixtures/project.rb
+++ b/activerecord/test/fixtures/project.rb
@@ -3,6 +3,7 @@ class Project < ActiveRecord::Base
has_and_belongs_to_many :non_unique_developers, :order => 'developers.name desc, developers.id desc', :class_name => 'Developer'
has_and_belongs_to_many :limited_developers, :class_name => "Developer", :limit => 1
has_and_belongs_to_many :developers_named_david, :class_name => "Developer", :conditions => "name = 'David'", :uniq => true
+ has_and_belongs_to_many :developers_named_david_with_hash_conditions, :class_name => "Developer", :conditions => { :name => 'David' }, :uniq => true
has_and_belongs_to_many :salaried_developers, :class_name => "Developer", :conditions => "salary > 0"
has_and_belongs_to_many :developers_with_finder_sql, :class_name => "Developer", :finder_sql => 'SELECT t.*, j.* FROM developers_projects j, developers t WHERE t.id = j.developer_id AND j.project_id = #{id}'
has_and_belongs_to_many :developers_by_sql, :class_name => "Developer", :delete_sql => "DELETE FROM developers_projects WHERE project_id = \#{id} AND developer_id = \#{record.id}"