Add Item#ancestors

This commit is contained in:
Wen-Tien Chang committed 2010-01-18 15:52:52 +08:00
1 parent e1440a79d8
commit 32e8bd108f
17 files changed
+60 -37

No files matched your search

+4 -4
View File
@@ -10,7 +10,7 @@ class Admin::LinksController < ApplicationController
def new
@link = Link.new
@link.is_published = true
@link.parent_item_name = @parent_item.name
@link.parent_name = @parent_item.name
end
def edit
@@ -22,7 +22,7 @@ class Admin::LinksController < ApplicationController
if @link.save
flash[:notice] = 'Link was successfully created.'
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
redirect_to admin_items_url( :parent_name => @link.parent_name )
else
render :action => "new"
end
@@ -33,7 +33,7 @@ class Admin::LinksController < ApplicationController
if @link.update_attributes(params[:link])
flash[:notice] = 'Link was successfully updated.'
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
redirect_to admin_items_url( :parent_name => @link.parent_name )
else
render :action => "edit"
end
@@ -43,7 +43,7 @@ class Admin::LinksController < ApplicationController
@link = Link.find(params[:id])
@link.destroy
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
redirect_to admin_items_url( :parent_name => @link.parent_name )
end
end