Skip to content
This repository
Browse code

oracle, y u defy me

  • Loading branch information...
commit 9abc94c44516afdcfe4a3b202c336c9578fd6d0d 1 parent 37d93ea
Jon Leighton jonleighton authored
2  activerecord/test/cases/associations/join_model_test.rb
@@ -305,7 +305,7 @@ def test_has_many_through_with_custom_primary_key_on_belongs_to_source
305 305 end
306 306
307 307 def test_has_many_through_with_custom_primary_key_on_has_many_source
308   - assert_equal [authors(:david), authors(:bob)], posts(:thinking).authors_using_custom_pk.order(:id)
  308 + assert_equal [authors(:david), authors(:bob)], posts(:thinking).authors_using_custom_pk.order('authors.id')
309 309 end
310 310
311 311 def test_both_scoped_and_explicit_joins_should_be_respected
10 activerecord/test/cases/reflection_test.rb
@@ -215,16 +215,16 @@ def test_chain
215 215
216 216 def test_conditions
217 217 expected = [
218   - ["tags.name = 'Blue'"],
219   - ["taggings.comment = 'first'", {"taggable_type"=>"Post"}],
220   - ["posts.title LIKE 'misc post%'"]
  218 + [{ :tags => { :name => 'Blue' } }],
  219 + [{ :taggings => { :comment => 'first' } }, { "taggable_type" => "Post" }],
  220 + [{ :posts => { :title => ['misc post by bob', 'misc post by mary'] } }]
221 221 ]
222 222 actual = Author.reflect_on_association(:misc_post_first_blue_tags).conditions
223 223 assert_equal expected, actual
224 224
225 225 expected = [
226   - ["tags.name = 'Blue'", "taggings.comment = 'first'", "posts.title LIKE 'misc post%'"],
227   - [{"taggable_type"=>"Post"}],
  226 + [{ :tags => { :name => 'Blue' } }, { :taggings => { :comment => 'first' } }, { :posts => { :title => ['misc post by bob', 'misc post by mary'] } }],
  227 + [{ "taggable_type" => "Post" }],
228 228 []
229 229 ]
230 230 actual = Author.reflect_on_association(:misc_post_first_blue_tags_2).conditions
6 activerecord/test/models/author.rb
@@ -131,10 +131,12 @@ def testing_proxy_target
131 131 has_many :post_categories, :through => :posts, :source => :categories
132 132 has_many :category_post_comments, :through => :categories, :source => :post_comments
133 133
134   - has_many :misc_posts, :class_name => 'Post', :conditions => "posts.title LIKE 'misc post%'"
  134 + has_many :misc_posts, :class_name => 'Post',
  135 + :conditions => { :posts => { :title => ['misc post by bob', 'misc post by mary'] } }
135 136 has_many :misc_post_first_blue_tags, :through => :misc_posts, :source => :first_blue_tags
136 137
137   - has_many :misc_post_first_blue_tags_2, :through => :posts, :source => :first_blue_tags_2, :conditions => "posts.title LIKE 'misc post%'"
  138 + has_many :misc_post_first_blue_tags_2, :through => :posts, :source => :first_blue_tags_2,
  139 + :conditions => { :posts => { :title => ['misc post by bob', 'misc post by mary'] } }
138 140
139 141 scope :relation_include_posts, includes(:posts)
140 142 scope :relation_include_tags, includes(:tags)
8 activerecord/test/models/post.rb
@@ -73,16 +73,16 @@ def add_joins_and_select
73 73 has_many :tags_with_destroy, :through => :taggings, :source => :tag, :dependent => :destroy
74 74 has_many :tags_with_nullify, :through => :taggings, :source => :tag, :dependent => :nullify
75 75
76   - has_many :misc_tags, :through => :taggings, :source => :tag, :conditions => "tags.name = 'Misc'"
  76 + has_many :misc_tags, :through => :taggings, :source => :tag, :conditions => { :tags => { :name => 'Misc' } }
77 77 has_many :funky_tags, :through => :taggings, :source => :tag
78 78 has_many :super_tags, :through => :taggings
79 79 has_many :tags_with_primary_key, :through => :taggings, :source => :tag_with_primary_key
80 80 has_one :tagging, :as => :taggable
81 81
82   - has_many :first_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.comment = 'first'"
83   - has_many :first_blue_tags, :through => :first_taggings, :source => :tag, :conditions => "tags.name = 'Blue'"
  82 + has_many :first_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => { :taggings => { :comment => 'first' } }
  83 + has_many :first_blue_tags, :through => :first_taggings, :source => :tag, :conditions => { :tags => { :name => 'Blue' } }
84 84
85   - has_many :first_blue_tags_2, :through => :taggings, :source => :blue_tag, :conditions => "taggings.comment = 'first'"
  85 + has_many :first_blue_tags_2, :through => :taggings, :source => :blue_tag, :conditions => { :taggings => { :comment => 'first' } }
86 86
87 87 has_many :invalid_taggings, :as => :taggable, :class_name => "Tagging", :conditions => 'taggings.id < 0'
88 88 has_many :invalid_tags, :through => :invalid_taggings, :source => :tag
2  activerecord/test/models/tagging.rb
@@ -6,7 +6,7 @@ class Tagging < ActiveRecord::Base
6 6 belongs_to :tag, :include => :tagging
7 7 belongs_to :super_tag, :class_name => 'Tag', :foreign_key => 'super_tag_id'
8 8 belongs_to :invalid_tag, :class_name => 'Tag', :foreign_key => 'tag_id'
9   - belongs_to :blue_tag, :class_name => 'Tag', :foreign_key => :tag_id, :conditions => "tags.name = 'Blue'"
  9 + belongs_to :blue_tag, :class_name => 'Tag', :foreign_key => :tag_id, :conditions => { :tags => { :name => 'Blue' } }
10 10 belongs_to :tag_with_primary_key, :class_name => 'Tag', :foreign_key => :tag_id, :primary_key => :custom_primary_key
11 11 belongs_to :interpolated_tag, :class_name => 'Tag', :foreign_key => :tag_id, :conditions => proc { "1 = #{1}" }
12 12 belongs_to :taggable, :polymorphic => true, :counter_cache => true

0 comments on commit 9abc94c

Please sign in to comment.
Something went wrong with that request. Please try again.