engine/lib/locomotive/liquid/db_file_system.rb

18 lines
537 B
Ruby
Raw Normal View History

2010-06-03 15:32:40 +00:00
module Locomotive
module Liquid
class DbFileSystem
# Works only with snippets
def read_template_file(site, template_path)
raise FileSystemError, "Illegal snippet name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
snippet = site.snippets.where(:slug => template_path).first
raise FileSystemError, "No such snippet '#{template_path}'" if snippet.nil?
snippet.template
2010-06-03 15:32:40 +00:00
end
end
end
end