Skip to content
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

Make sorting optional #9

Closed
wvengen opened this issue Feb 22, 2018 · 1 comment
Closed

Make sorting optional #9

wvengen opened this issue Feb 22, 2018 · 1 comment

Comments

@wvengen
Copy link

wvengen commented Feb 22, 2018

Ancestry does not do sorting by default, and this gem currently requires the presence of a sorting attribute.
Could the sorting become optional (e.g. by setting sorting_attribute to nil)? Then only the hierarchy would be updated but not the pos attribute (or whetever is configured).

@maxivak
Copy link
Owner

maxivak commented Mar 8, 2018

Updated in v. 0.0.9.
see the doc

  • Example. For model with ancestry.
    If you use ancestry in model - set :parent_method to 'parent'.
  include SortableTreeController::Sort
  sortable_tree 'ClassName', {parent_method: 'parent', sorting_attribute: 'pos'}
  • Example. Do only sorting, without tree.
  include SortableTreeController::Sort
  sortable_tree 'ClassName', {sorting_attribute: 'pos', parent_method: nil}
  • Example. No sorting, update only parent.
  include SortableTreeController::Sort
  sortable_tree 'ClassName', {sorting_attribute: nil, parent_method: 'parent'}

@maxivak maxivak closed this as completed Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants