I have a model that acts as a nested set (tree), like so:
class Position < ActiveRecord::Base
attr_accessible :parent_id
acts_as_nested_set
belongs_to :person
belongs_to :parent, :class_name => 'Position', :foreign_key => :parent_id
has_many :children, :class_name => 'Position', :foreign_key => :parent_id
end
My ability.rb file contains this:
can :read, Position, :id => #a list of position ids
The list of ids will change depending on another setting that is not important to this situation.
My question is, how do get @position.children to only return those positions that are authorized in the ability?