Integrating with acts_as_list
Clone this wiki locally
If you want acts_as_list to work with ancestry, getting the sorting "sorted out" can be tricky.
class Page < ActiveRecord::Base has_ancestry acts_as_list scope: [:ancestry] end
The trick here is wrapping
:ancestry in an
Array. This causes acts_as_list to treat the scope as a hash condition (
:ancestry => ancestry) which correctly becomes
ancestry IS NULL or
ancestry = 'some value' as necessary.