Closed maxim closed 8 years ago
Hi @maxim :) Thanks for bring this up. I've created a PR with a test that confirms the bug: https://github.com/swanandp/acts_as_list/pull/220
If you come up with any insight as to how to work around this problem, please let me know :)
Updated the PR with a fix though it actually changes tested behaviour so I'm not quite sure wether to merge it or not.
Closed by #220.
0.8.0 has been released and includes this change.
Thank you very much for maintaining this gem. Have a use case that could maybe use a little love (I know it's been discussed before, but not enough it seems).
We have acts_as_list declared like this:
In DB position default is set to 1, but the problem is: each new record still goes to the bottom. Setting position to 1 explicitly, or using
position_will_change!
doesn't help (probably because it's equal to what's already set by default). A note in the README says this is normal, and refers to "recent discussions", however, that note was written in 2011, and I couldn't find any discussion that helps work around this, would appreciate some help.I did also try adding
add_new_at: :top
, but with that the problem is that it always goes to the top, even when a position is provided.I managed to hack together this workaround, the downside being that I have to use this method instead of standard AR create, and it has to do the creation in 2 DB interactions.
Wonder if there is better way to do this that I could at least help document.