Natural sorting for nested set
Add this line to your application's Gemfile:
gem 'nested_set_natural_sort'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nested_set_natural_sort
Add in your model, after acts_as_nested_set
class Catalog < ActiveRecord::Base
acts_as_nested_set
nested_set_natural_sort
...
By default, gem sort by field name
. You cat change it
class Catalog < ActiveRecord::Base
acts_as_nested_set
nested_set_natural_sort by_field: :title
...
Bug reports and pull requests are welcome on GitHub at https://github.com/Tyralion/nested_set_natural_sort
Author: Tyralion ([email protected])
Copyright (c) 2016 Tyralion, released under the BSD license