Created to demonstrate STI failure with elasticsearch-model gem (issue)
rails db:migrate
rails runner script.rb
rails server
- Navigate to localhost:3000
- This works
- Trigger a rails reload (add a newline to a file in app/)
- Refresh page
- Should fail
rails console
- run
require_dependency 'animal'
Elasticsearch::Model.search("Fluffy").records.to_a
- This works
reload!
Elasticsearch::Model.search("Fluffy").records.to_a
- This should fail
From here, you can also check Elasticsearch::Model::Registry.all
to see that there are two of the same classes in the registry, one of which erroneously contains no descendants.