Move runtime Rails version check into railtie.rb

This commit is contained in:
Tee Parham 2013-12-27 12:36:03 -07:00
parent 6ba1985b84
commit c12ea707c7
2 changed files with 8 additions and 8 deletions

View File

@ -18,13 +18,6 @@ module Haml
end
# check for a compatible Rails version when Haml is loaded
if defined?(Rails) && (actionpack_spec = Gem.loaded_specs['actionpack'])
if actionpack_spec.version.to_s < '3.2'
raise Exception.new("\n\n** Haml now requires Rails 3.2 and later. Use Haml version 4.0.4\n\n")
end
end
require 'haml/util'
require 'haml/engine'
require 'haml/railtie' if defined?(Rails::Railtie)

View File

@ -1,4 +1,11 @@
if defined?(ActiveSupport)
# check for a compatible Rails version when Haml is loaded
if (activesupport_spec = Gem.loaded_specs['activesupport'])
if activesupport_spec.version.to_s < '3.2'
raise Exception.new("\n\n** Haml now requires Rails 3.2 and later. Use Haml version 4.0.4\n\n")
end
end
require 'haml/template/options'
ActiveSupport.on_load(:before_initialize) do
ActiveSupport.on_load(:action_view) do
@ -19,4 +26,4 @@ module Haml
end
require "haml/helpers/safe_erubis_template"
Haml::Filters::Erb.template_class = Haml::SafeErubisTemplate
Haml::Filters::Erb.template_class = Haml::SafeErubisTemplate