def model
      if @resource_tree.size > 1
        parent_model_id = params["#{@resource_tree.first.name.to_s.singularize}_id"]
        model = @resource_tree.first.model.find(parent_model_id)
        @resource_tree.drop(1).each do |resource|
          model = model.send resource.name
        end
        model
      else
        super.all
      end
    end
def model
      if @resource_tree.size > 1
        parent_model_id = params["#{@resource_tree.first.name.to_s.singularize}_id"]
        model = @resource_tree.first.model.find(parent_model_id)
        @resource_tree.drop(1).each do |resource|
          model = model.send resource.name
        end
        model
      else
        super.all
      end
    end
Determine the model to use depending on the request. If a sub-resource
 was requested, use the parent model to get the association. Otherwise, use
 all the resource's model's records.