Permalink
Browse files

add html_safe after compile to fix partials

  • Loading branch information...
1 parent 3485a7e commit ac6115a2571e690ef2b4c09512b835ba68722e6f @fringd fringd committed Jan 26, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/coffeebeans.rb
View
@@ -9,24 +9,24 @@ def self.erb_handler
def self.call(template)
compiled_source = erb_handler.call(template)
- "::CoffeeScript.compile(begin;#{compiled_source};end)"
+ "::CoffeeScript.compile(begin;#{compiled_source};end).html_safe"
end
end
end
-
+
module ViewHelpers
-
+
def coffee_script_tag(&block)
content_tag(:script, coffee_script(&block), :type => 'text/javascript')
end
-
+
def coffee_script(&block)
::CoffeeScript.compile(capture(&block)).html_safe
end
-
+
end
-
+
end
ActionView::Template.register_template_handler :coffee, CoffeeBeans::Handlers::CoffeeScript
-ActionView::Base.send :include, CoffeeBeans::ViewHelpers
+ActionView::Base.send :include, CoffeeBeans::ViewHelpers

0 comments on commit ac6115a

Please sign in to comment.