```ruby
if defined?(ActiveRecord)
  RSpec::Matchers::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::MatchArray)
end
```

Check to see if the module we're actually working with is loaded (in case only pieces of ActiveRecord are loaded).
user
```ruby
if defined?(ActiveRecord::Relation)
  RSpec::Matchers::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::MatchArray)
end
```
assistant