Skip to content
Latest commit eb48291 @jferris jferris committed with karmi [MODEL] Fixed `#dup` behaviour for Elasticsearch::Model
Previously, calling #dup for an Elasticsearch::Model instance would
retain the original __elasticsearch__ reference. Given the following

    user = User.create!(name: "Will")
    other = user.dup
    other.update!(name: "Bill")

You'd end up with two references to "Will" in Elasticsearch, and none
for "Bill," because the duplicate instance proxied to the original
instance's attributes.

With this fix, each duplicate gets its own proxy, so attributes are
saved correctly.

Closes #517
Failed to load latest commit information.
elasticsearch [MODEL] Fixed `#dup` behaviour for Elasticsearch::Model
Something went wrong with that request. Please try again.