Skip to content

Dirty tracking lost when setting parent with numeric_order option #414

Description

@ryanb

Say I have a model with numeric_order option:

class Category < ApplicationRecord
  has_closure_tree order: "position", numeric_order: true
end

With this setting we lose dirty tracking after setting the parent:

category.update! parent: parent_category, name: "Foo"
category.saved_change_to_name? # => false

All dirty tracking is lost since it ends up calling reload internally.

Perhaps this code could just reload the order attribute instead of the entire record? This way dirty tracking would persist.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions