the-teacher/the_sortable_tree

Sort pages in different companies

Closed this issue · 3 comments

We have multiple companies that have a sortable tree. However, when we sort the tree inside one company, it doesn't take into account the scope of the company, thus mixing every page and messing everything up :(

So. Can you say to me - have you some default scope for Company model?

Drag & Drop Sorting should just place node to another position in tree, but its shouldn't sort you tree.

You can use skype for you questions - my login: ilya.killich

A page has a company_id. So we have
sortable_tree company.pages

Drag&drop updates the positions of lft and rgt of a page. This works correctly (in a very nice way, I must say!) if you only have one company. But if you have more companies, it mixes the lft and rgt of pages belonging to different companies, causing all kinds of unexpected errors.

Easy solution:

acts_as_nested_set scope: :company

Credits go to @the-teacher