awesome_nested_set
awesome_nested_set copied to clipboard
Validate lft and rgt should be less then max sequence
Validate lft
and rgt
should be less then max sequence which is (number of records * 2)
i.e.
category1 = { parent_id: nil, lft: 1, rgt: 2 }
category2 = { parent_id: nil, lft: 3, rgt: 4 }
category3 = { parent_id: nil, lft: 9, rgt: 10 }
In above case, Category.valid?
returns true
, but expecting to return false
so that it can rebuild again to correct the sequence.
Please feel free to close this PR if my changes looks invalid, as I noticed the scenario which I mentioned was considered as valid case and covered in spec that way.