Sha256: 58ae43a2bd2ededf69ba96f7e264ce66d56cdc6695ddb83488309dd840b8b815

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

if defined?(ActionView) and defined?(ActionView::Base)
  
  class ActionView::Template
    
    alias_method :render_original, :render
    
    def render(view, locals, buffer=nil, &block)

      previous_whowish_word_page = nil
      
      if view.instance_variable_defined?(:@whowish_word_page)
        previous_whowish_word_page = view.instance_variable_get(:@whowish_word_page)
      end
    
      view.instance_variable_set(:@whowish_word_page, @identifier)
      
      if view.controller.respond_to?(:whowish_word_edit_mode)
        view.instance_variable_set(:@whowish_word_edit_mode, view.controller.whowish_word_edit_mode)
      end
      
      html = render_original(view, locals, buffer, &block)
      
      view.instance_variable_set(:@whowish_word_page, previous_whowish_word_page)

      return html
    end
  
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whowish_word-0.3.3 lib/whowish_word/action_view/template.rb
whowish_word-0.3.2 lib/whowish_word/action_view/template.rb