Permalink
Browse files

Merge pull request #8 from fringd/master

here's the fix to make including .coffee files from .js.erb not require a raw
  • Loading branch information...
2 parents 3485a7e + ac6115a commit cd25de2db8e0d14eb5fe765c088af33e1c5e95b1 @markbates 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 cd25de2

Please sign in to comment.