diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-12 15:31:50 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-12 15:31:50 -0500 |
commit | 99cc85bc099a757cdd44e4f5f1be4972ab124e0d (patch) | |
tree | 376ed5a7338c0182e9f4d8ebf549059758d38853 /actionpack/lib/action_view/paths.rb | |
parent | 73b34e9f75d33dc0709d4ad36c912bdbb8977994 (diff) | |
download | rails-99cc85bc099a757cdd44e4f5f1be4972ab124e0d.tar.gz rails-99cc85bc099a757cdd44e4f5f1be4972ab124e0d.tar.bz2 rails-99cc85bc099a757cdd44e4f5f1be4972ab124e0d.zip |
Set config.action_view.warn_cache_misses = true to receive a warning if you perform an action that results in an expensive disk operation that could be cached
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index 0fa7d3dad3..b0ab7d0c67 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -1,7 +1,18 @@ module ActionView #:nodoc: class PathSet < Array #:nodoc: def self.type_cast(obj) - obj.is_a?(String) ? Path.new(obj) : obj + if obj.is_a?(String) + if Base.warn_cache_misses && defined?(Rails) && Rails.initialized? + Rails.logger.debug "[PERFORMANCE] Processing view path during a " + + "request. This an expense disk operation that should be done at " + + "boot. You can manually process this view path with " + + "ActionView::Base.process_view_paths(#{obj.inspect}) and set it " + + "as your view path" + end + Path.new(obj) + else + obj + end end class Path #:nodoc: |