Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patron name clash with business entity #1059

Open
pedrocarmona opened this issue Jun 20, 2024 · 2 comments
Open

Patron name clash with business entity #1059

pedrocarmona opened this issue Jun 20, 2024 · 2 comments

Comments

@pedrocarmona
Copy link

If an application has a table patrons and a model Patron, then it causes webmock not to work, because it checks if Patron is defined. Because Patron is defined, it fails with uninitialized constant Patron::Session

# lib/webmock/http_lib_adapters/patron_adapter.rb
begin
  require 'patron'
rescue LoadError
  # patron not found
end

if defined?(::Patron) # <<<--- replace this?
@pedrocarmona
Copy link
Author

maybe replace with?

if defined?(::Patron) && defined?(::Patron::Session) 

@bblimke
Copy link
Owner

bblimke commented Jun 21, 2024

@pedrocarmona thanks for explaining the issue.

I believe if defined?(::Patron::Session) should be enough, there is no need to check for if defined?(::Patron) && defined?(::Patron::Session)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants