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

2,981 views
Skip to first unread message

gmile

unread,
Nov 9, 2011, 7:53:12 AM11/9/11
to rubyonra...@googlegroups.com
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 `<main>'
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?

Irongaze

unread,
Nov 18, 2011, 1:50:34 PM11/18/11
to rubyonra...@googlegroups.com
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.

Irongaze

unread,
Nov 18, 2011, 2:18:40 PM11/18/11
to rubyonra...@googlegroups.com
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.

JoeLoui

unread,
Nov 24, 2011, 11:27:10 AM11/24/11
to Ruby on Rails: Core
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!

Prem Sichanugrist

unread,
Nov 24, 2011, 11:35:30 PM11/24/11
to rubyonra...@googlegroups.com
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

Sent from my iPhone

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
>

Wael Nasreddine

unread,
Nov 25, 2011, 12:37:36 AM11/25/11
to rubyonra...@googlegroups.com
Maybe MonkeyPatch in an initializer? or in config/application.rb just
after loading rails?

--
Wael Nasreddine
Sent from my iPhone

JoeLoui

unread,
Nov 25, 2011, 7:33:18 AM11/25/11
to Ruby on Rails: Core
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...

On Nov 25, 2:37 am, Wael Nasreddine <wael.nasredd...@gmail.com> wrote:
> Maybe MonkeyPatch in an initializer? or in config/application.rb just
> after loading rails?
>
> --
> Wael Nasreddine
> Sent from my iPhone
>

> On Nov 25, 2011, at 5:35, Prem Sichanugrist <sikand...@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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
>
> > Sent from my iPhone
>

> > On Nov 24, 2011, at 8:56 PM, JoeLoui <joe.escala...@gmail.com> wrote:
>
> >> 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 repohttps://github.com/jescalante/rails/tree/patch-1


> >> or watch the fix (it's just a line! :-P)
>
> >> Greetings!
>
> >> On Nov 18, 4:18 pm, Irongaze <zaph...@gmail.com> wrote:
> >>> 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.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> >> To post to this group, send email to rubyonra...@googlegroups.com.
> >> To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.

> >> For more options, visit this group athttp://groups.google.com/group/rubyonrails-core?hl=en.

gmile

unread,
Nov 25, 2011, 8:16:44 AM11/25/11
to rubyonra...@googlegroups.com
Any idea of what to put in config/application.rb?

Wael M. Nasreddine

unread,
Nov 25, 2011, 8:21:25 AM11/25/11
to rubyonra...@googlegroups.com
What about:

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

Just after loading rails!

On Fri, Nov 25, 2011 at 14:16, gmile <iame...@gmail.com> wrote:
Any idea of what to put in config/application.rb?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/3NCQ45YBRVcJ.

To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Waêl Nasreddine
TechnoGate www.technogate.fr
mobile :  06.41.68.38.35
agence : 09.70.444.236
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

JoeLoui

unread,
Nov 25, 2011, 8:36:10 AM11/25/11
to Ruby on Rails: Core
As Wael, I put a initializer (config/initializers) with a single line:
MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1]
and that's it!

On Nov 25, 10:21 am, "Wael M. Nasreddine" <wael.nasredd...@gmail.com>
wrote:


> What about:
>
> MissingSourceFile::REGEXPS.push([/^cannot load such file -- (.+)$/i, 1])
>
> Just after loading rails!
>

> On Fri, Nov 25, 2011 at 14:16, gmile <iamex...@gmail.com> wrote:
> > Any idea of what to put in *config/application.rb*?

Juan David Pastás Rivera

unread,
Aug 5, 2013, 7:23:05 PM8/5/13
to rubyonra...@googlegroups.com
It did not work for me either. I will try with ruby 1.9.2.

On Saturday, September 29, 2012 5:22:23 AM UTC-5, Geoffrey Raymond wrote:
When I run:
rails s

I get this error:
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `write_inheritable_array' for #<Class:0x00000003c2c380> (NoMethodError)

I tried your solution I made a file in config/initializers/ with:

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

Any help would be very appreciated. I am fairly new so could you explain steps, please.
Thanks!

Alexandr Gajdosh

unread,
Aug 6, 2013, 8:04:08 AM8/6/13
to rubyonra...@googlegroups.com
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 

Juan David Pastás Rivera

unread,
Aug 6, 2013, 11:15:34 AM8/6/13
to rubyonra...@googlegroups.com
Thanks, how much did you take migrating? any other advice?


--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-core/gb5woRkmDlk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-co...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages