lib/draper/view_context.rb in draper-0.9.3 vs lib/draper/view_context.rb in draper-0.9.5
- old
+ new
@@ -1,11 +1,21 @@
module Draper
module ViewContext
+ def self.current
+ Thread.current[:current_view_context]
+ end
+
+ def self.current=(input)
+ Thread.current[:current_view_context] = input
+ end
+ end
+
+ module ViewContextFilter
def set_current_view_context
- Thread.current[:current_view_context] = self.view_context
+ Draper::ViewContext.current = self.view_context
end
-
+
def self.included(source)
- source.send(:before_filter, :set_current_view_context)
+ source.send(:before_filter, :set_current_view_context) if source.respond_to?(:before_filter)
end
end
-end
\ No newline at end of file
+end