From 9fccf72725a72baeda508eccd6113b44329e0a7c Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Fri, 28 Nov 2008 14:31:54 -0600 Subject: fixed template recompile issue with previous commit and add some better tests so we can make sure it doesn't happen again --- actionpack/lib/action_view/template.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'actionpack/lib/action_view/template.rb') diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index ca82454c0b..b486392ac4 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -57,6 +57,11 @@ module ActionView #:nodoc: end memoize :relative_path + def mtime + File.mtime(filename) + end + memoize :mtime + def source File.read(filename) end @@ -79,6 +84,19 @@ module ActionView #:nodoc: end end + def stale? + File.mtime(filename) > mtime + end + + def loaded? + @loaded + end + + def load! + @loaded = true + freeze + end + private def valid_extension?(extension) Template.template_handler_extensions.include?(extension) -- cgit v1.2.3