Replies: 1 comment 6 replies
-
|
Hi @nickjj, thanks for that. It's interesting to see other code around this problem :) This positionable concern is more akin to My gem certainly triggers more SQL and inverts the positions to be negative, then positive again (as its method of creating gaps) as a way to allow for unique position indexes. Performance wise, you'd have to run some benchmarks that simulate how you'd use the list (always appending to the end, with infrequent reorderings?). Usability wise, a gem is easier to include in your code and to keep up to date. You'd have to check in on the concern every now and then to see if they'd changed anything or fixed any bugs. My gem also has a bit more support around it for updating the value using relative positions and has the struct for making those workable within forms in Rails. Hope that helps a bit. I always wondered what Basecamp did for positioning since they abandoned ActsAsList :) Thanks for posting this here :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Writebook is a tool designed by Basecamp as part of their "Once" line of tools. It's free.
It comes with a
Positionableconcern that you can use in a model such aspositioned_within :book, association: :leaves, filter: :active.Here's the concern's code:
Here's its test suite:
Given the above, are there pros and cons of using that vs your gem? Both appear to support similar features of setting a position. Any performance gotchas or edge cases that you see in the concern that your gem is immune to?
Beta Was this translation helpful? Give feedback.
All reactions