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

active_record_patch.rb (ActiveRecord::Base#method_missing monkey patch) interferes with dynamic finders #504

Closed
smtlaissezfaire opened this issue Aug 31, 2017 · 0 comments

Comments

@smtlaissezfaire
Copy link
Contributor

Why is method_missing overwritten on ActiveRecord::Base?

This took plenty of my time today: tracking down why dynamic finders like find_by_foo! weren't working, but find_by!(foo: ...) was working. Here's a debugging session that tracked it down:

https://gist.github.com/smtlaissezfaire/1669e7ddc66773c3a95794ce41b29d49

This happened when I ran the following:

rake db:drop db:create db:migrate db:seed

Strangely enough it didn't happen when I ran seeds alone:

rake db:seed

I guess the annotate code wasn't loaded in the second example, which is why I didn't run into it.

@ctran ctran closed this as completed Feb 14, 2019
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