draper: Error when deploying to production in Rails 5

Hi,

I am getting the following error when deploying to production server:

remote:        NameError: uninitialized constant ActionController::TestRequest
remote:        /tmp/build_c921c5050ebe0693cf4cd93b38e9b5d4/vendor/bundle/ruby/2.3.0/gems/draper-3.0.0.pre1/lib/draper/view_context/build_strategy.rb:41:in `block in controller'
remote:        /tmp/build_c921c5050ebe0693cf4cd93b38e9b5d4/vendor/bundle/ruby/2.3.0/gems/draper-3.0.0.pre1/lib/draper/view_context/build_strategy.rb:40:in `tap'
remote:        /tmp/build_c921c5050ebe0693cf4cd93b38e9b5d4/vendor/bundle/ruby/2.3.0/gems/draper-3.0.0.pre1/lib/draper/view_context/build_strategy.rb:40:in `controller'

This is using draper-3.0.0.pre1 in Rails 5.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 15 (7 by maintainers)

Most upvoted comments

For those running into a similar issue, you can use my fork for the time being: https://github.com/hgani/draper

Put this in your Gemfile: gem 'draper', git: 'https://github.com/hgani/draper.git'

Additional information: the error is also happening in some of my background (Sidekiq) workers.

Any ideas when this is going to get merged, or should we keep using hgani’s fork in Rails 5?

@seanlinsley Thanks for the quick response

It seems that the error is happening during asset precompilation.

Some parts of our javascript code is dynamically generated so we have files such as example.js.erb

The .js.erb files contain Rails code that helps generate the final javascript file, some of this code might be using my presenters (which uses draper).