rails/prototype-rails

uninitialized constant AbstractController::Rendering in Rails 4.2

guigs opened this issue · 14 comments

I'm trying to migrate an app that still uses prototype from Rails 4.1 to 4.2.

I'm using Rails 4.2.rc2.

Steps to reproduce:

rails new testapp -j prototype
cd testapp
rails s

Throws this error:

ruby/gems/2.1.0/gems/actionpack-4.2.0.rc2/lib/action_controller/base.rb:204:in `<class:Base>': uninitialized constant AbstractController::Rendering (NameError)

Using branch 4.2 AND reverting bc80415 would fix the problem.

I think a better fix is requiring in in prototype-rails and not loading the test-case and relying on it's side-effects

... the revert bc80415 breaks it, with the if Rails.env.test? it works ... so fix is using a sha from before the revert ... or opening a rails issue to make TestCase load Rendering

if defined? ActionView::TestCase solution does not work.

if ActionView.const_defined?(:TestCase) also does not work ... nor does ActionView.constants.include?(:TestCase)

other options:

  • making requiring test-case not blow up (still ugly and unnecessary that it is loaded)
  • setting some config/initializer to get testing extensions (Rails.env.test? || config.load_prototype_test_extensions)

+1 I'm currently having the same problem. Any chances of rebasing branch 4.2 with current master? Looks like the fix was introduced into master and I'm trying to update from Rails 4.1 to 4.2 so having 4.2 up to day would save me (and everyone else doing it 😄) the fork

👍 thank you

Sorry, so what do we need to do to get rid of this issue with 4.2 and prototype-rails 4.0.0? Thanks.

In Gemfile:
gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'

Excellent. Thanks!

WORKED FOR ME
gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'

There's some fixes in master that aren't in the 4.2 branch. Maybe it's time to get things merged back into master now? @rafaelfranca

Any news on this boring bug please?

Luckily, in my case, my tests aren't testing anything which uses Javascript so I "fixed" my issue with the following in my Gemfile:

gem 'prototype-rails', '~> 4.0.0', group: [:development, :production]