prototype-rails icon indicating copy to clipboard operation
prototype-rails copied to clipboard

uninitialized constant AbstractController::Rendering in Rails 4.2

Open guigs opened this issue 11 years ago • 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)

guigs avatar Dec 06 '14 01:12 guigs

Using branch 4.2 AND reverting bc8041559a11c16ef25228b019250b3cc122e115 would fix the problem.

guigs avatar Dec 08 '14 15:12 guigs

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

grosser avatar Dec 08 '14 16:12 grosser

... the revert https://github.com/rails/prototype-rails/commit/bc8041559a11c16ef25228b019250b3cc122e115 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

grosser avatar Dec 11 '14 05:12 grosser

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

grosser avatar Dec 11 '14 05:12 grosser

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)

grosser avatar Dec 11 '14 05:12 grosser

+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 :smile:) the fork

guiman avatar Jan 27 '15 22:01 guiman

Done

rafaelfranca avatar Jan 27 '15 22:01 rafaelfranca

:+1: thank you

guiman avatar Jan 27 '15 22:01 guiman

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

cpanderson avatar Feb 04 '15 19:02 cpanderson

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

guigs avatar Feb 04 '15 20:02 guigs

Excellent. Thanks!

cpanderson avatar Feb 04 '15 20:02 cpanderson

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

shibabu avatar Apr 27 '15 11:04 shibabu

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

pschambacher avatar Mar 03 '16 17:03 pschambacher

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]

zedtux avatar Dec 06 '16 14:12 zedtux