diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index 9c4c2989..4a368dbb 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -243,7 +243,7 @@ module Shoulda # :nodoc: def join_table_exists? if @macro != :has_and_belongs_to_many || - ::ActiveRecord::Base.connection.tables.include?(join_table) + model_class.connection.tables.include?(join_table) true else @missing = "join table #{join_table} doesn't exist"