diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-23 10:41:28 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-23 10:41:28 -0500 |
commit | 97a954bf1dd05e79a873bffc94fcf5420b807371 (patch) | |
tree | 76f072b03526a4a46799a56e62bbd2950cea1570 /actionpack/lib/action_view | |
parent | db1bac796e2d53fac4b51a3f560010b8f663fb54 (diff) | |
download | rails-97a954bf1dd05e79a873bffc94fcf5420b807371.tar.gz rails-97a954bf1dd05e79a873bffc94fcf5420b807371.tar.bz2 rails-97a954bf1dd05e79a873bffc94fcf5420b807371.zip |
Load view path cache after plugins and gems.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 18 |
1 files changed, 15 insertions, 3 deletions
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 |