@@ -249,52 +249,52 @@ class Joo < ActiveRecord::Base
249249 before do
250250
251251 # Create some tables
252- ActiveRecord ::Migration . create_table ( :mars ) { |t | t . integer :koo_id ; t . integer :baz_id }
253- ActiveRecord ::Migration . create_table ( :bazs ) { |t | t . string :related }
252+ ActiveRecord ::Migration . create_table ( :mars ) { |t | t . integer :koo_id ; t . integer :zab_id }
253+ ActiveRecord ::Migration . create_table ( :zabs ) { |t | t . string :related }
254254 ActiveRecord ::Migration . create_table ( :koos ) { |t | t . string :foo }
255255
256256 # The related classes
257- class Mar < ActiveRecord ::Base ; belongs_to :baz ; belongs_to :koo ; end
258- class Baz < ActiveRecord ::Base ; has_many :mars ; end
257+ class Mar < ActiveRecord ::Base ; belongs_to :zab ; belongs_to :koo ; end
258+ class Zab < ActiveRecord ::Base ; has_many :mars ; end
259259
260260 # The class on which to call search_for
261261 class Koo < ActiveRecord ::Base
262262 has_many :mars
263263 # having the source option here is not needed for the statement correctness.
264264 # It is here to fail the code introduced in 2.6.2 that wrongly detected source instead of source_type
265265 # as an indication for a polymorphic relation.
266- has_many :bazs , :through => :mars , :source => :baz
266+ has_many :zabs , :through => :mars , :source => :zab
267267
268- scoped_search :relation => :bazs , :on => :related
268+ scoped_search :relation => :zabs , :on => :related
269269 end
270270
271271 @koo_1 = Koo . create! ( :foo => 'foo' )
272272 @koo_2 = Koo . create! ( :foo => 'foo too' )
273273 @koo_3 = Koo . create! ( :foo => 'foo three' )
274274
275- @baz_1 = Baz . create ( :related => 'baz ' )
276- @baz_2 = Baz . create ( :related => 'baz too!' )
275+ @zab_1 = Zab . create ( :related => 'zab ' )
276+ @zab_2 = Zab . create ( :related => 'zab too!' )
277277
278- @bar_1 = Mar . create! ( :koo => @koo_1 , :baz => @baz_1 )
278+ @bar_1 = Mar . create! ( :koo => @koo_1 , :zab => @zab_1 )
279279 @bar_2 = Mar . create! ( :koo => @koo_1 )
280- @bar_3 = Mar . create! ( :koo => @koo_2 , :baz => @baz_1 )
281- @bar_3 = Mar . create! ( :koo => @koo_2 , :baz => @baz_2 )
282- @bar_3 = Mar . create! ( :koo => @koo_2 , :baz => @baz_2 )
280+ @bar_3 = Mar . create! ( :koo => @koo_2 , :zab => @zab_1 )
281+ @bar_3 = Mar . create! ( :koo => @koo_2 , :zab => @zab_2 )
282+ @bar_3 = Mar . create! ( :koo => @koo_2 , :zab => @zab_2 )
283283 @bar_4 = Mar . create! ( :koo => @koo_3 )
284284 end
285285
286286 after do
287- ActiveRecord ::Migration . drop_table ( :bazs )
287+ ActiveRecord ::Migration . drop_table ( :zabs )
288288 ActiveRecord ::Migration . drop_table ( :mars )
289289 ActiveRecord ::Migration . drop_table ( :koos )
290290 end
291291
292- it "should find the two records that are related to a baz record" do
293- Koo . search_for ( 'baz ' ) . length . should == 2
292+ it "should find the two records that are related to a zab record" do
293+ Koo . search_for ( 'zab ' ) . length . should == 2
294294 end
295295
296- it "should find the two records that are related to a baz record" do
297- Koo . search_for ( 'related=baz AND related="baz too!"' ) . length . should == 1
296+ it "should find the two records that are related to a zab record" do
297+ Koo . search_for ( 'related=zab AND related="zab too!"' ) . length . should == 1
298298 end
299299 end
300300
@@ -303,45 +303,45 @@ class Koo < ActiveRecord::Base
303303 before do
304304
305305 # Create some tables
306- ActiveRecord ::Migration . create_table ( :zars ) { |t | t . integer :baz_id }
307- ActiveRecord ::Migration . create_table ( :bazs ) { |t | t . string :related }
306+ ActiveRecord ::Migration . create_table ( :zars ) { |t | t . integer :zab_id }
307+ ActiveRecord ::Migration . create_table ( :zabs ) { |t | t . string :related }
308308 ActiveRecord ::Migration . create_table ( :zoos ) { |t | t . integer :zar_id ; t . string :foo }
309309
310310 # The related classes
311- class Zar < ActiveRecord ::Base ; belongs_to :baz ; has_many :zoos ; end
312- class Baz < ActiveRecord ::Base ; has_many :zars ; end
311+ class Zar < ActiveRecord ::Base ; belongs_to :zab ; has_many :zoos ; end
312+ class Zab < ActiveRecord ::Base ; has_many :zars ; end
313313
314314 # The class on which to call search_for
315315 class Zoo < ActiveRecord ::Base
316316 belongs_to :zar
317- has_many :bazs , :through => :zar
317+ has_many :zabs , :through => :zar
318318
319- scoped_search :relation => :bazs , :on => :related
319+ scoped_search :relation => :zabs , :on => :related
320320 end
321321
322- baz_1 = Baz . create ( :related => 'baz ' )
323- baz_2 = Baz . create ( :related => 'baz too!' )
322+ zab_1 = Zab . create ( :related => 'zab ' )
323+ zab_2 = Zab . create ( :related => 'zab too!' )
324324
325- zar_1 = Zar . create! ( :baz => baz_1 )
326- zar_2 = Zar . create! ( :baz => baz_2 )
325+ zar_1 = Zar . create! ( :zab => zab_1 )
326+ zar_2 = Zar . create! ( :zab => zab_2 )
327327
328328 Zoo . create! ( :zar => zar_1 , :foo => 'foo' )
329329 Zoo . create! ( :zar => zar_1 , :foo => 'foo too' )
330330 Zoo . create! ( :zar => zar_2 , :foo => 'foo three' )
331331 end
332332
333333 after do
334- ActiveRecord ::Migration . drop_table ( :bazs )
334+ ActiveRecord ::Migration . drop_table ( :zabs )
335335 ActiveRecord ::Migration . drop_table ( :zars )
336336 ActiveRecord ::Migration . drop_table ( :zoos )
337337 end
338338
339- it "should find the three records that are related to a baz record" do
340- Zoo . search_for ( 'baz ' ) . length . should == 3
339+ it "should find the three records that are related to a zab record" do
340+ Zoo . search_for ( 'zab ' ) . length . should == 3
341341 end
342342
343- it "should find no records that are related to a baz record" do
344- Zoo . search_for ( 'related=baz AND related="baz too!"' ) . length . should == 0
343+ it "should find no records that are related to a zab record" do
344+ Zoo . search_for ( 'related=zab AND related="zab too!"' ) . length . should == 0
345345 end
346346 end
347347
@@ -392,8 +392,8 @@ class Owner < ActiveRecord::Base
392392 @tag_2 = Tag . create! ( :foo => 'foo too' )
393393 @tag_3 = Tag . create! ( :foo => 'foo three' )
394394
395- @dog_1 = Dog . create ( :related => 'baz ' )
396- @dog_2 = Dog . create ( :related => 'baz too!' )
395+ @dog_1 = Dog . create ( :related => 'zab ' )
396+ @dog_2 = Dog . create ( :related => 'zab too!' )
397397 @cat_1 = Cat . create ( :related => 'mitzi' )
398398
399399 @owner_1 = Owner . create ( :name => 'Fred' , :dogs => [ @dog_1 ] )
@@ -429,11 +429,11 @@ class Owner < ActiveRecord::Base
429429 end
430430
431431 it "should find the two tags that are related to a dog record" do
432- Tag . search_for ( 'dog=baz ' ) . length . should == 2
432+ Tag . search_for ( 'dog=zab ' ) . length . should == 2
433433 end
434434
435435 it "should find the 3 tags that are related to dogs record" do
436- Tag . search_for ( 'baz ' ) . length . should == 3
436+ Tag . search_for ( 'zab ' ) . length . should == 3
437437 end
438438 end
439439
@@ -547,52 +547,52 @@ class User < ActiveRecord::Base
547547 before do
548548
549549 # Create some tables with namespaces
550- ActiveRecord ::Migration . create_table ( :zan_mars ) { |t | t . integer :koo_id ; t . integer :baz_id }
551- ActiveRecord ::Migration . create_table ( :zan_bazs ) { |t | t . string :related }
550+ ActiveRecord ::Migration . create_table ( :zan_mars ) { |t | t . integer :koo_id ; t . integer :zab_id }
551+ ActiveRecord ::Migration . create_table ( :zan_zabs ) { |t | t . string :related }
552552 ActiveRecord ::Migration . create_table ( :zan_koos ) { |t | t . string :foo }
553553
554554 # The related classes
555- module Zan ; class Mar < ActiveRecord ::Base ; belongs_to :baz ; belongs_to :koo ; self . table_name = "zan_mars" ; end ; end
556- module Zan ; class Baz < ActiveRecord ::Base ; has_many :mars ; self . table_name = "zan_bazs " ; end ; end
555+ module Zan ; class Mar < ActiveRecord ::Base ; belongs_to :zab ; belongs_to :koo ; self . table_name = "zan_mars" ; end ; end
556+ module Zan ; class Zab < ActiveRecord ::Base ; has_many :mars ; self . table_name = "zan_zabs " ; end ; end
557557
558558 # The class on which to call search_for
559559 module Zan
560560 class Koo < ActiveRecord ::Base
561561 has_many :mars , :class_name => "Zan::Mar"
562- has_many :bazs , :through => :mars
562+ has_many :zabs , :through => :mars
563563 self . table_name = "zan_koos"
564564
565- scoped_search :relation => :bazs , :on => :related
565+ scoped_search :relation => :zabs , :on => :related
566566 end
567567 end
568568
569569 @koo_1 = Zan ::Koo . create! ( :foo => 'foo' )
570570 @koo_2 = Zan ::Koo . create! ( :foo => 'foo too' )
571571 @koo_3 = Zan ::Koo . create! ( :foo => 'foo three' )
572572
573- @baz_1 = Zan ::Baz . create ( :related => 'baz ' )
574- @baz_2 = Zan ::Baz . create ( :related => 'baz too!' )
573+ @zab_1 = Zan ::Zab . create ( :related => 'zab ' )
574+ @zab_2 = Zan ::Zab . create ( :related => 'zab too!' )
575575
576- @bar_1 = Zan ::Mar . create! ( :koo => @koo_1 , :baz => @baz_1 )
576+ @bar_1 = Zan ::Mar . create! ( :koo => @koo_1 , :zab => @zab_1 )
577577 @bar_2 = Zan ::Mar . create! ( :koo => @koo_1 )
578- @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :baz => @baz_1 )
579- @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :baz => @baz_2 )
580- @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :baz => @baz_2 )
578+ @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :zab => @zab_1 )
579+ @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :zab => @zab_2 )
580+ @bar_3 = Zan ::Mar . create! ( :koo => @koo_2 , :zab => @zab_2 )
581581 @bar_4 = Zan ::Mar . create! ( :koo => @koo_3 )
582582 end
583583
584584 after do
585- ActiveRecord ::Migration . drop_table ( :zan_bazs )
585+ ActiveRecord ::Migration . drop_table ( :zan_zabs )
586586 ActiveRecord ::Migration . drop_table ( :zan_mars )
587587 ActiveRecord ::Migration . drop_table ( :zan_koos )
588588 end
589589
590- it "should find the two records that are related to a baz record" do
591- Zan ::Koo . search_for ( 'baz ' ) . length . should == 2
590+ it "should find the two records that are related to a zab record" do
591+ Zan ::Koo . search_for ( 'zab ' ) . length . should == 2
592592 end
593593
594- it "should find the one record that is related to two baz records" do
595- Zan ::Koo . search_for ( 'related=baz AND related="baz too!"' ) . length . should == 1
594+ it "should find the one record that is related to two zab records" do
595+ Zan ::Koo . search_for ( 'related=zab AND related="zab too!"' ) . length . should == 1
596596 end
597597 end
598598
0 commit comments