mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
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:
parent
1dcbe68ee8
commit
b3a2af7488
1 changed files with 5 additions and 1 deletions
|
@ -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 ||= {}
|
||||
|
|
Loading…
Add table
Reference in a new issue