-
Notifications
You must be signed in to change notification settings - Fork 802
SystemStackError when importing STI model #170
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
Comments
I have this working now... I created an |
@AaronRustad Glad to hear that :) I'm abroad this week, so will reply later more thoroughly, but the way you approach it is correct -- just create another component, which encapsulates the functionality. (See eg. the |
Aaron, I was thinking about this, and I guess I still have the same opinion about STI: I don't want to invest time and energy into tweaking the codebase to support it... If there's a greater demand for it, I can always bite into it.
... where you get into the whole story of traversing class I'm leaning towards closing this, if you've managed to solve it. We can always re-open the issue when the demand is there... |
Yes, I'm good to close this issue. |
This patch adds support for inheriting index_name and document_type on an opt-in basis: Elasticsearch::Model.inheritance_enabled = true class Animal < ActiveRecord::Base document_type 'mammal' index_name 'mammals' end class Dog < Animal end Animal.document_type # 'mammal' Animal.index_name # 'mammals' Dog.document_type # 'mammal' Dog.index_name # 'mammals' Closes #332 Related: #28, #92, #170, #344
OK, I know that STI is frowned upon here, but my application is what it is. ;-)
I'm seeing a SystemStackError when I try to import a model participating in an STI configuration.
User.import
works as expected, but when I try to importApiKey
, I get aSystemStackError
.I've tracked it down to
Elasticsearch::Model::Proxy::Base
, and tried some basic/ugly debugging:Which yields the following:
target.respond_to?(:import)
returnstrue
, so it callstarget.__send__
on ApiKey. It then of course eventually raises a SystemStackError.Any advice would be helpful. I know @karmi doesn't like STI all that much, but I am hoping to solve this either by modifying the elasticsearch ruby source or adjusting my application in some way (hopefully not changing the STI relationship).
Thanks!
AR.
The text was updated successfully, but these errors were encountered: