lib/sht_rails/handlebars.rb in sht_rails-0.2.2 vs lib/sht_rails/handlebars.rb in sht_rails-0.2.3

- old
+ new

@@ -3,14 +3,17 @@ module ShtRails module Handlebars def self.context(partials = nil) - @context = nil unless ActionView::Resolver.caching? - @context ||= begin + @context = begin context = ::Handlebars::Context.new + runtime = context.instance_variable_get(:@js) + + ShtRails.dependencies.each { |dependency| runtime.eval dependency.source } + if helpers = Rails.application.assets.find_asset(ShtRails.helper_path) - context.instance_variable_get(:@js).eval helpers.source + runtime.eval helpers.source end partials.each { |key, value| context.register_partial(key, value) } if partials context end end \ No newline at end of file