Sha256: 9df5fbb3e1009cebe8e513d49f6031d6bed383e9f585ca477fb749305d07bf44

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

class Memento
  module ActionControllerMethods
    
    private
    
    def memento
      block_result = nil
      memento_session = Memento.instance.memento(current_user) do
        block_result = yield
      end
      if memento_session
        response.headers["X-Memento-Session-Id"] = memento_session.id.to_s
      end
      block_result
    end
  end
end

ActionController::Base.send(:include, Memento::ActionControllerMethods) if defined?(ActionController::Base)

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
yolk-memento-0.2.0 lib/memento/action_controller_methods.rb
memento-0.3.0 lib/memento/action_controller_methods.rb