Also initialize ViewContext for rails runner (#739)
Initialize Draper's ViewContext when using the runner command in a similar way to using the console command. Without this code run by the rails runner command (e.g. when processing commands from a message queue) will not have a properly initialized ViewContext, and consequently the helpers will not be initialized.
This commit is contained in:
parent
bc222f5dc7
commit
2e6f741a63
|
@ -55,6 +55,12 @@ module Draper
|
|||
Draper::ViewContext.build
|
||||
end
|
||||
|
||||
runner do
|
||||
require 'action_controller/test_case'
|
||||
ApplicationController.new.view_context
|
||||
Draper::ViewContext.build
|
||||
end
|
||||
|
||||
rake_tasks do
|
||||
Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue