Module: Stache::ViewContextFilter

Defined in:
lib/stache/view_context.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(source) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/stache/view_context.rb', line 17

def self.included(source)
  if source.respond_to?(:before_action) # Rails 4+
    source.send(:before_action, :set_current_view_context)
  elsif source.respond_to?(:before_filter) # Rails 3
    source.send(:before_filter, :set_current_view_context)
  end
end

Instance Method Details

#set_current_view_contextObject



13
14
15
# File 'lib/stache/view_context.rb', line 13

def set_current_view_context
  Stache::ViewContext.current = self.view_context
end