From 2938ef7a65be5527905174b348b58c98a06d20e4 Mon Sep 17 00:00:00 2001 From: Andy Shipman Date: Thu, 11 Oct 2012 17:36:58 +0100 Subject: Allow for deep directory path for view templates. --- actionpack/lib/action_view/digestor.rb | 2 +- actionpack/test/fixtures/digestor/level/below/_header.html.erb | 0 actionpack/test/fixtures/digestor/level/below/index.html.erb | 1 + actionpack/test/template/digestor_test.rb | 6 ++++++ 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 actionpack/test/fixtures/digestor/level/below/_header.html.erb create mode 100644 actionpack/test/fixtures/digestor/level/below/index.html.erb diff --git a/actionpack/lib/action_view/digestor.rb b/actionpack/lib/action_view/digestor.rb index 5d3add4091..f5852dbe73 100644 --- a/actionpack/lib/action_view/digestor.rb +++ b/actionpack/lib/action_view/digestor.rb @@ -64,7 +64,7 @@ module ActionView end def directory - name.split("/").first + name.split("/")[0..-2].join("/") end def partial? diff --git a/actionpack/test/fixtures/digestor/level/below/_header.html.erb b/actionpack/test/fixtures/digestor/level/below/_header.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionpack/test/fixtures/digestor/level/below/index.html.erb b/actionpack/test/fixtures/digestor/level/below/index.html.erb new file mode 100644 index 0000000000..b92f49a8f8 --- /dev/null +++ b/actionpack/test/fixtures/digestor/level/below/index.html.erb @@ -0,0 +1 @@ +<%= render partial: "header" %> diff --git a/actionpack/test/template/digestor_test.rb b/actionpack/test/template/digestor_test.rb index 01b101cb49..8181aa11f7 100644 --- a/actionpack/test/template/digestor_test.rb +++ b/actionpack/test/template/digestor_test.rb @@ -59,6 +59,12 @@ class TemplateDigestorTest < ActionView::TestCase change_template("comments/_comment") end end + + def test_directory_depth_dependency + assert_digest_difference("level/below/index") do + change_template("level/below/_header") + end + end def test_logging_of_missing_template assert_logged "Couldn't find template for digesting: messages/something_missing.html" do -- cgit v1.2.3