Skip to content

[PERSISTENCE] Forward document type to mappings #366

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

Closed
wants to merge 4 commits into from
Closed

[PERSISTENCE] Forward document type to mappings #366

wants to merge 4 commits into from

Conversation

miguelff
Copy link
Contributor

This PR tries to fix the bug described in #270

The problem was the following.

  • Once a model extends Persistence::Model it sets up two attributes. As a consequence, the attribute macro instantiates a Elasticsearch::Model::Indexing::Mappings in the model. This instance contains an attribute @type that defaults to the model name in lowercase.
  • Any other definition of document_type will override the document_type in the gateway delegate, but the mappings instance originally created in the previous step remains untouched, and hence in an inconsistent state.

What I did here is: Instead of simply forward document_type to the gateway, also change the mappings' document_type accordingly, leaving it in a correct state.

An integration test was modified, in order to have a regression of the fix.

@miguelff miguelff changed the title Forward document type to mappings [PERSISTENCE] Forward document type to mappings Apr 11, 2015
@karmi karmi added the waiting label Apr 22, 2015
@karmi
Copy link
Contributor

karmi commented Apr 22, 2015

Waiting for unit tests, otherwise good to merge!

@miguelff
Copy link
Contributor Author

@karmi Done.

@karmi karmi closed this in 2b338c1 Apr 28, 2015
@karmi
Copy link
Contributor

karmi commented Apr 28, 2015

Thanks, Miguel!, merged.

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

Successfully merging this pull request may close these issues.

2 participants