diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-08-26 15:13:28 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-26 15:13:28 -0500 |
commit | 9853134b4fec468962260f0e713d2f87046eb8b3 (patch) | |
tree | fe10eded92f430171b8c3dd752d0aaa45240dde3 /actionpack/lib/action_view/helpers | |
parent | 8756dd75b257b17ddda92674d4cc0db307d2153b (diff) | |
download | rails-9853134b4fec468962260f0e713d2f87046eb8b3.tar.gz rails-9853134b4fec468962260f0e713d2f87046eb8b3.tar.bz2 rails-9853134b4fec468962260f0e713d2f87046eb8b3.zip |
Require missing libraries and check for defined ActionController constant so ActionView can be used standalone
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/sanitize_helper.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb index 637caf203b..435ba936e1 100644 --- a/actionpack/lib/action_view/helpers/sanitize_helper.rb +++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb @@ -1,5 +1,14 @@ require 'action_view/helpers/tag_helper' -require 'html/document' + +begin + require 'html/document' +rescue LoadError + html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner" + if File.directory?(html_scanner_path) + $:.unshift html_scanner_path + require 'html/document' + end +end module ActionView module Helpers #:nodoc: diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index f9096d0029..ccd6c54cc8 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -1,5 +1,14 @@ require 'action_view/helpers/tag_helper' -require 'html/document' + +begin + require 'html/document' +rescue LoadError + html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner" + if File.directory?(html_scanner_path) + $:.unshift html_scanner_path + require 'html/document' + end +end module ActionView module Helpers #:nodoc: |