mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Using ActiveRecord::Base.connection is presumptuous. You must infer the home of the join table using the parent model. This allows developers to define HABTM relationships in other databases and still use the 'have_and_belong_to_many' matcher.
This commit is contained in:
parent
f6edb1589f
commit
41c763d276
1 changed files with 1 additions and 1 deletions
|
@ -243,7 +243,7 @@ module Shoulda # :nodoc:
|
||||||
|
|
||||||
def join_table_exists?
|
def join_table_exists?
|
||||||
if @macro != :has_and_belongs_to_many ||
|
if @macro != :has_and_belongs_to_many ||
|
||||||
::ActiveRecord::Base.connection.tables.include?(join_table)
|
model_class.connection.tables.include?(join_table)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
@missing = "join table #{join_table} doesn't exist"
|
@missing = "join table #{join_table} doesn't exist"
|
||||||
|
|
Loading…
Reference in a new issue