From 0d8879354fbd251e4509a0ab5c6b6e47aa3fa47d Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 19 Jul 2009 18:40:07 +0200 Subject: fixed link_for_path issue --- app/helpers/link_helper.rb | 4 +++- app/views/nodes/index.html.erb | 2 +- test/functional/nodes_controller_test.rb | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 3be5953..b40aa4b 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb @@ -1,7 +1,9 @@ module LinkHelper def link_to_path title, path, html_options = {} - active = (params[:page_path].join("/") == path.sub(/^\//, "")) + if params[:page_path] + active = (params[:page_path].join("/") == path.sub(/^\//, "")) + end params[:locale] ||= I18n.locale diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index 727cfa1..2f6069f 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb @@ -17,7 +17,7 @@ <%= node.id %>

<%= link_to title_for_node(node), edit_node_path(node) %>

-

<%= link_to_path(node.unique_name, node.unique_path) %>

+

<%= link_to_path(node.unique_name, node.unique_name) %>

<%= link_to 'Preview', node_path(node) %> diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 1c7e607..ff9aa68 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb @@ -6,6 +6,8 @@ class NodesControllerTest < ActionController::TestCase def test_get_index Node.root.descendants.delete_all + test_node = Node.create :slug => "foo" + test_node.move_to_child_of Node.root login_as :quentin get :index assert_response :success -- cgit v1.3