class Admin::ItemsController < ApplicationController layout "admin" before_filter :find_parent_item before_filter :find_snippets, :only => :index def index @items = Item.all( :conditions => { :parent_id => @parent_item.id } ) @items.unshift Item.find_by_name("root") if @parent_item.name == 'root' end protected def find_snippets @snippets = Snippet.all( :conditions => { :parent_id => @parent_item.id } ) end end