thoughtbot/shoulda-matchers · error · NotImplementedError

`deprecated` association matcher is only available on Active

Error message

`deprecated` association matcher is only available on Active Record >= 8.1.

What it means

Error "`deprecated` association matcher is only available on Active Record >= 8.1." thrown in thoughtbot/shoulda-matchers.

Source

Thrown at lib/shoulda/matchers/active_record/association_matcher.rb:1650

          self
        end

        def strict_loading(strict_loading = true)
          @options[:strict_loading] = strict_loading
          self
        end

        def join_table(join_table_name)
          @options[:join_table_name] = join_table_name
          self
        end

        def deprecated(deprecated = true)
          if Shoulda::Matchers::RailsShim.active_record_gte_8_1?
            @options[:deprecated] = deprecated
            self
          else
            raise NotImplementedError,
              '`deprecated` association matcher is only available on Active Record >= 8.1.'
          end
        end

        def without_validating_presence
          remove_submatcher(AssociationMatchers::RequiredMatcher)
          self
        end

        def description
          description = "#{macro_description} #{name}"
          if options.key?(:class_name)
            description += " class_name => #{options[:class_name]}"
          end
          [description, submatchers.map(&:description)].flatten.join(' ')
        end

        def failure_message

View on GitHub (pinned to 79cdfbc326)

When it happens

Trigger: Thrown at lib/shoulda/matchers/active_record/association_matcher.rb:1650 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thoughtbot/shoulda-matchers@79cdfbc326 (2026-08-23). Data as JSON: /api/errors/e612a8554493de80. Report an issue: GitHub.