Break reliance on ActionController.

Originally brought up in #249, I didn't know how to fix this.

But now I do.
This commit is contained in:
Steve Klabnik 2012-08-28 22:47:16 -07:00
parent 1dcbe68ee8
commit b3a2af7488
1 changed files with 5 additions and 1 deletions

View File

@ -1,8 +1,12 @@
module Draper
module ViewContext
def self.included(controller)
@controller = controller
end
def self.current
Thread.current[:current_view_context].tap do |context|
context ||= ApplicationController.new.view_context
context ||= @controller.new.view_context
context.controller.request ||= ActionController::TestRequest.new
context.request ||= context.controller.request
context.params ||= {}