Skip to content

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