aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/resolver.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-10-10 23:11:50 +0200
committerJosé Valim <jose.valim@gmail.com>2010-10-10 23:12:23 +0200
commit5ec27189b8b433145baa7270cf4219c5041f6a4c (patch)
tree60978ebf6493b79f450215f057e2353f9795a0b8 /actionpack/lib/action_view/template/resolver.rb
parent682368d4ba0bb4548f896d02bc4e038ee8ba6b4d (diff)
downloadrails-5ec27189b8b433145baa7270cf4219c5041f6a4c.tar.gz
rails-5ec27189b8b433145baa7270cf4219c5041f6a4c.tar.bz2
rails-5ec27189b8b433145baa7270cf4219c5041f6a4c.zip
Do not allow templates coming from Fallback resolvers to store a virtual path.
Diffstat (limited to 'actionpack/lib/action_view/template/resolver.rb')
-rw-r--r--actionpack/lib/action_view/template/resolver.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index 5c6877a923..7707dbcf98 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -135,6 +135,7 @@ module ActionView
end
end
+ # A resolver that loads files from the filesystem.
class FileSystemResolver < PathResolver
def initialize(path)
raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver)
@@ -152,4 +153,16 @@ module ActionView
end
alias :== :eql?
end
+
+ # The same as FileSystemResolver but does not allow templates to store
+ # a virtual path since it is invalid for such resolvers.
+ class FallbackFileSystemResolver < FileSystemResolver
+ def self.instances
+ [new(""), new("/")]
+ end
+
+ def decorate(*)
+ super.each { |t| t.virtual_path = nil }
+ end
+ end
end