mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Compatibility with the latest edge Rails.
This commit is contained in:
parent
839ad95909
commit
40a18ff882
1 changed files with 9 additions and 3 deletions
|
@ -10,11 +10,17 @@ module Haml
|
|||
1
|
||||
end
|
||||
|
||||
def compile(source)
|
||||
def compile(template)
|
||||
options = Haml::Template.options.dup
|
||||
|
||||
# template is set in Rails >=2.1.0
|
||||
options[:filename] ||= template.filename if defined?(template) && template
|
||||
# template is a template object in Rails >=2.1.0,
|
||||
# a source string previously
|
||||
if template.respond_to? :source
|
||||
options[:filename] = template.filename
|
||||
source = template.source
|
||||
else
|
||||
source = template
|
||||
end
|
||||
|
||||
Haml::Engine.new(source, options).send(:precompiled_with_ambles, [])
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue