lib/draper/view_context.rb in draper-0.15.0 vs lib/draper/view_context.rb in draper-0.16.0
- old
+ new
@@ -1,21 +1,17 @@
module Draper
module ViewContext
def self.current
- Thread.current[:current_view_context]
+ Thread.current[:current_view_context] || view_context
end
def self.current=(input)
Thread.current[:current_view_context] = input
end
- end
- module ViewContextFilter
- def set_current_view_context
- Draper::ViewContext.current = self.view_context
- end
-
- def self.included(source)
- source.send(:before_filter, :set_current_view_context) if source.respond_to?(:before_filter)
+ def view_context
+ super.tap do |context|
+ Draper::ViewContext.current = context
+ end
end
end
end