Rony 1.9.3-p0 on Rails 2.3.x: the helpers "require" problem

Yes, I know that Rails 2.3.x is no longer fully supported (this is why I’m posting it to rails/issues). Still, I would like to post the topic so that everyone who experience the same problem could quickly google for it (no, afaik no solution for this yet).

I’m trying to migrate a 1.5 years 2.3.x app from Ruby version 1.8.7 to 1.9.3-p0.

The strange problem I encountered is that all controllers in my app have to have a corresponding helper class in /helpers folder. What made me think so is the following trace (and the steps I made after):

gmile@gmile-K52Jr:~/intrview$ rake spec
/home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rspec-1.3.1/lib/spec/runner/options.rb:188: Use RbConfig instead of obsolete and deprecated Config.
/home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3:in <top (required)>': iconv will be deprecated in the future, use String#encode instead. NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. Gem.source_index called from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21. rename /home/gmile/intrview/lib/controllers_ext/clearence_ext.rb /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in **require’: cannot load such file – admin/chargify_exports_helper (LoadError)**
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in require' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:291:in require_or_load’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:250:in depend_on' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:162:in require_dependency’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/actionpack-2.3.14/lib/action_controller/helpers.rb:197:in default_helper_module!' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/actionpack-2.3.14/lib/action_controller/helpers.rb:212:in inherited_with_helper’
**from /home/gmile/intrview/app/controllers/admin/chargify_exports_controller.rb:1:in <top (required)>'** from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in require’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in require' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:291:in require_or_load’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:250:in depend_on' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:162:in require_dependency’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rails-2.3.14/lib/initializer.rb:414:in block (2 levels) in load_application_classes' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rails-2.3.14/lib/initializer.rb:413:in each’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rails-2.3.14/lib/initializer.rb:413:in block in load_application_classes' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rails-2.3.14/lib/initializer.rb:411:in each’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rails-2.3.14/lib/initializer.rb:411:in load_application_classes' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rails-2.3.14/lib/initializer.rb:197:in process’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rails-2.3.14/lib/initializer.rb:113:in run' from /home/gmile/intrview/config/environment.rb:9:in <top (required)>’
from /home/gmile/intrview/spec/spec_helper.rb:4:in require' from /home/gmile/intrview/spec/spec_helper.rb:4:in <top (required)>’
from spec/models/formsite_form_spec.rb:1:in require' from spec/models/formsite_form_spec.rb:1:in <top (required)>’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:15:in load' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:15:in block in load_files’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:14:in each' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:14:in load_files’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rspec-1.3.1/lib/spec/runner/options.rb:134:in run_examples' from /home/gmile/.rvm/gems/ruby-1.9.3-p0\@interview/gems/rspec-1.3.1/lib/spec/runner/command_line.rb:9:in run’
from /home/gmile/.rvm/gems/ruby-1.9.3-p0@interview/gems/rspec-1.3.1/bin/spec:5:in `’
rake aborted!

After I added an empty admin/chargify_exports_helper file to /helpers folder, I passes but starts to complain about another one missing helper file. I wish I knew Rails internals well to fix this by myself.

So, anyone know a workaround on this?

I’m seeing the same problem. With a server full of legacy Rails 2.3.5 apps, attempting to run using Ruby 1.9.3p0 gives multiple LoadErrors for non-existent helper files. Does not seem to occur with latest Ruby 1.9.2. Vexing.

Will post to this thread if I find a workaround. Going to update my local dev box’s RVM installation to 1.9.3p0 to see if I can find a solution.

I’m seeing the same issue. Rails 2.3.5, Ruby 1.9.3p0, LoadError’s for “missing” helpers all over the place. For the moment, am downgrading to Ruby 1.9.2p290 until I can sort this out.

I found the problem! I forked rails and request a pull (https://
github.com/rails/rails/pull/3745), but they rejected it because 2.3 is
no longer mantained... :-/

However if you want, you can fork my repo https://github.com/jescalante/rails/tree/patch-1
or watch the fix (it's just a line! :-P)

Greetings!

I was actually thinking it would be nice if you will be able to make
it as a gem or plugin, but I don't know if gem/plugin can override
that setting just in time before the exception ever came up or not.

- Prem

Maybe MonkeyPatch in an initializer? or in config/application.rb just
after loading rails?

That is a good idea, it doesn't seems too complicated. Like Prem says,
I too don't know if a gem/plugin could go that deep, I'll try the
initializer idea...

Any idea of what to put in config/application.rb?

What about:

MissingSourceFile::REGEXPS.push([/^cannot load such file – (.+)$/i, 1])

Just after loading rails!

As Wael, I put a initializer (config/initializers) with a single line:
MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1]
and that's it!

It did not work for me either. I will try with ruby 1.9.2.

As for me it is a bad idea to start updating your project from ruby. Update Rails version first. Then replace all plugins with gems in your Gemfile. Ruby 1.8.7 is supported up to rails3.2.

After you update rails and gems you can start updating ruby version.

I am saying this from ,my own experience, I had updated a Rails2.3/ruby 1.8.7 app to rails4.0.0/ruby 1.9.3

Thanks, how much did you take migrating? any other advice?