From 97a954bf1dd05e79a873bffc94fcf5420b807371 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 23 Jul 2008 10:41:28 -0500 Subject: Load view path cache after plugins and gems. --- actionpack/lib/action_view/paths.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_view/paths.rb') diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index 9cb50ab4f8..a37706faee 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -27,11 +27,10 @@ module ActionView #:nodoc: attr_reader :path, :paths delegate :to_s, :to_str, :hash, :inspect, :to => :path - def initialize(path) + def initialize(path, load = true) raise ArgumentError, "path already is a Path class" if path.is_a?(Path) - @path = path.freeze - reload! + reload! if load end def ==(path) @@ -46,6 +45,14 @@ module ActionView #:nodoc: @paths[path] end + def loaded? + @loaded ? true : false + end + + def load + reload! unless loaded? + end + # Rebuild load path directory cache def reload! @paths = {} @@ -59,6 +66,7 @@ module ActionView #:nodoc: end @paths.freeze + @loaded = true end private @@ -71,6 +79,10 @@ module ActionView #:nodoc: end end + def load + each { |path| path.load } + end + def reload! each { |path| path.reload! } end -- cgit v1.2.3