brendon / acts_as_list

An ActiveRecord plugin for managing lists.

Home Page:http://brendon.github.io/acts_as_list/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Get first/last of scope

klementtan opened this issue · comments

I would like to make a feature request for a function for a parent object to return the first/last children. The parent object has children that implements act_as_list with the parent as its scope.

Hi @klementtan, if you're looking for a way to store inheritance information, check out the ancestry gem. This gem works well with acts_as_list.

As far as getting the first or last item within a scope, that comes with ActiveRecord; you can call first and last on a scoped relation to get the appropriate record.

Understood thanks!