# Rails 2.0.2 upgrade difficulties

**URL:** <https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847>\
**Category:** Engines\
**Created:** [January 3, 2008, 2:00am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847 "2008-01-03T02:00:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 3, 2008, 2:00am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/1 "2008-01-03T02:00:30Z")

</div>

Getting a routing error when I tried upgrading to Rails 2.0.2.

… vendor/plugins/engines/lib/engines/rails\_extensions/routing.rb:69:in  
`from\_plugin’: You have a nil object when you didn’t expect it!  
(NoMethodError)  
The error occurred while evaluating nil.routes\_path from …

Any ideas on this? Its possible there is a 2.0 issue with my code or  
another plugin but the logs show only the following …

Attempting to copy plugin assets from  
‘…vendor/plugins/calendar\_date\_select/public’ to  
‘… public/plugin\_assets’  
\*\* has\_many\_polymorphs: rails environment detected  
\*\* has\_many\_polymorphs: loaded ok

TIA,

Sean

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 3, 2008, 2:21am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/2 "2008-01-03T02:21:32Z")

</div>

I had that problem, and it was that I had a from\_plugin call in my app’s  
routes to a plugin that actually didn’t exist. If you’re sure the  
plugin  
does exist, can you try editing that file and make it like:

module Engines::RailsExtensions::Routing

# Loads the set of routes from within a plugin and evaluates them at

this

# point within an application’s main routes.rb file.

# 

# Plugin routes are loaded from \<plugin\_root\>/routes.rb.

def from\_plugin(name)  
map = self # to make ‘map’ available within the plugin route file

```
# add these debug stmts
Engines.logger.debug "Trying to load plugin #{name}'s routes."
Engines.logger.debug "Engines loaded so far: 

```

#{Engines.plugins.collect  
(&:name).inspect}"

```
routes_path = Engines.plugins[name].routes_path
Engines.logger.debug "loading routes from #{routes_path}"
eval(IO.read(routes_path), binding, routes_path) if File.file

```

?(routes\_path)  
end  
end

…

and let us know what the result of those lines is?

Can you also paste in the full stack trace?

thnx

-Andrew

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 3, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/3 "2008-01-03T16:15:31Z")

</div>

> I had that problem, and it was that I had a from\_plugin call in my app’s  
> routes to a plugin that actually didn’t exist. If you’re sure the plugin  
> does exist, can you try editing that file and make it like:

The plugin definitely exists. The mappings worked fine until I  
upgraded to Rails 2.0.2 and the Engines trunk.

> and let us know what the result of those lines is?

Trying to load plugin railscart’s routes.  
Engines loaded so far: [“engines”, “acts\_as\_list”,  
“calendar\_date\_select”, “has\_many\_polymorphs”, “paginating\_find”]

> Can you also paste in the full stack trace?

9152  
=\> Booting WEBrick…  
D:/client-work/gp2/vendor/plugins/engines/lib/engines/rails\_extensions/routing.rb:74:in  
`from_plugin': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.routes_path from D:/client-work/gp2/config/routes.rb:18 from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1250:in`draw’  
from D:/client-work/gp2/config/routes.rb:1  
from  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active\_support/dependencies.rb:489:in  
`load' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in`load’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active\_support/dependencies.rb:342:in  
`new_constants_in_without_injection' from D:/client-work/gp2/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/dependencies.rb:29:in`new\_constants\_in’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active\_support/dependencies.rb:489:in  
`load' ... 46 levels... from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from ./script/server:3  
from -e:4:in `load’  
from -e:4

> -Andrew

Sean

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 3, 2008, 11:12pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/4 "2008-01-03T23:12:35Z")

</div>

> Just guessing, but … maybe it isn’t a valid plugin in terms of Rails  
> 2.0? I.e. does it have an init.rb file and/or a lib subdirectory?

Yes it has both. Is that a problemo?

Sean

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 3, 2008, 5:48pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/5 "2008-01-03T17:48:13Z")

</div>

Am 03.01.2008 um 16:15 schrieb Sean Schofield:

> > I had that problem, and it was that I had a from\_plugin call in my  
> > app’s  
> > routes to a plugin that actually didn’t exist. If you’re sure the  
> > plugin  
> > does exist, can you try editing that file and make it like:
> 
> The plugin definitely exists. The mappings worked fine until I  
> upgraded to Rails 2.0.2 and the Engines trunk.

Just guessing, but … maybe it isn’t a valid plugin in terms of Rails  
2.0? I.e. does it have an init.rb file and/or a lib subdirectory?

It obviously is not present in Engines.plugins:

> Trying to load plugin railscart’s routes.  
> Engines loaded so far: [“engines”, “acts\_as\_list”,  
> “calendar\_date\_select”, “has\_many\_polymorphs”, “paginating\_find”]

We might want to raise a more meaningful error or log a warning in  
this case …

–  
sven fuchs removed\_email\_address@domain.invalid  
artweb design [http://www.artweb-design.de](http://www.artweb-design.de)  
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)  
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 4, 2008, 12:17am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/6 "2008-01-04T00:17:51Z")

</div>

Am 03.01.2008 um 23:12 schrieb Sean Schofield:

> > Just guessing, but … maybe it isn’t a valid plugin in terms of  
> > Rails  
> > 2.0? I.e. does it have an init.rb file and/or a lib subdirectory?
> 
> Yes it has both. Is that a problemo?

Whoops, no. Sorry for not being more clear.

Rails regards a directory with an init.rb and/or a lib subdir as a  
valid plugin. As such it should be added to the Engines.plugins hash.  
If it’s not there when routing is initialized, something pretty weird  
is going on.

–  
sven fuchs removed\_email\_address@domain.invalid  
artweb design [http://www.artweb-design.de](http://www.artweb-design.de)  
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)  
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 4, 2008, 4:29pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/7 "2008-01-04T16:29:19Z")

</div>

OK I found out the root of the problem (actually Andrew R. helped me  
find it during a brief chat last night.)

I’m using active\_merchant in my project and I’m requiring it from the  
railscart plugin (that’s the plugin that was coming up nil.)  
Ultimately active\_merchant does the following in integrations.rb:

Inflector.inflections do |inflect|  
inflect.uncountable ‘bogus’  
end

Somehow this is kicking off the mapping stuff before it should. I  
don’t know enough about Rails, plugins or Engines to say why this is  
happening but that’s what I’m observing.

If I move “require ‘active\_merchant’” from railscart’s init.rb and  
move into the application’s environment.rb everything works fine. The  
mappings are loaded and no nasty stack trace.

Weird. But resolved now. Thanks to everyone for all of the help.

Sean

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [April 17, 2008, 2:41am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/8 "2008-04-17T02:41:30Z")

</div>

Wow, thank you so much for posting this. This is very helpful. I was  
frustrated by the same error.

thanks again!

Tim

Roger P. wrote:

> > Attempting to copy plugin assets from  
> > ‘…vendor/plugins/calendar\_date\_select/public’ to  
> > ‘… public/plugin\_assets’  
> > As a side note this seemed to be repeated over and over in  
> > egines-=possibly without harm?

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [January 12, 2008, 11:26pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/9 "2008-01-12T23:26:44Z")

</div>

> Attempting to copy plugin assets from  
> ‘…vendor/plugins/calendar\_date\_select/public’ to  
> ‘… public/plugin\_assets’  
> As a side note this seemed to be repeated over and over in  
> egines-=possibly without harm?

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [April 17, 2008, 12:18pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/10 "2008-04-17T12:18:45Z")

</div>

Sorry, but I can’t get this to work:

When starting webrick I get the following error:  
/vendor/plugins/engines/lib/  
engines/rails\_extensions/routing.rb:69:in `from_plugin': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.routes_path from /config/routes.rb:4 from C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/routing.rb:1250:in`draw’  
from /config/routes.rb:1  
… lots of levels…  
from C:/ruby/bin/rdebug-ide:16:in `load’  
from C:/ruby/bin/rdebug-ide:16

engines (with savage beast) was working fine before this . . . but now  
the ruby error is vastly above my understanding of these plugins. if i  
comment out:

map.from\_plugin :savage\_beast

in my routes.rb file, then everything works.

any help here is greatly appreciated – I don’t understand engines as  
well as I should, and I can’t properly troubleshoot this.

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [April 28, 2008, 12:40am UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/11 "2008-04-28T00:40:22Z")

</div>

In my case, I also had troubles with “the big upgrade”. I discovered  
this thread here, in particlar Sean Schofield’s post about the active  
merchant plugin’s inflector problem, and taking inspiration from that, I  
added the following code to my environment.rb, inside the config block:

config.plugins = [:all, :active\_merchant]

Now my application is loading correctly! Thanks to all who explored this  
issue… it was a real pain.

Ron Evans

> **[Dead Programmer Society](https://deadprogrammersociety.com/)**
>
> Carpe Codex!

> Tim B. wrote:  
> Sorry, but I can’t get this to work:
> 
> When starting webrick I get the following error:  
> /vendor/plugins/engines/lib/  
> engines/rails\_extensions/routing.rb:69:in `from_plugin': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.routes_path from /config/routes.rb:4 from C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/routing.rb:1250:in `draw’  
> from /config/routes.rb:1  
> … lots of levels…  
> from C:/ruby/bin/rdebug-ide:16:in `load’  
> from C:/ruby/bin/rdebug-ide:16
> 
> engines (with savage beast) was working fine before this . . . but now  
> the ruby error is vastly above my understanding of these plugins. if i  
> comment out:
> 
> map.from\_plugin :savage\_beast
> 
> in my routes.rb file, then everything works.
> 
> any help here is greatly appreciated – I don’t understand engines as  
> well as I should, and I can’t properly troubleshoot this.

---

<div class="post-metadata">

**Author:** ![Sean\_Schofield](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@Sean\_Schofield](https://www.ruby-forum.com/u/Sean_Schofield)\
**Post date:** [December 27, 2008, 6:11pm UTC](https://www.ruby-forum.com/t/rails-2-0-2-upgrade-difficulties/124847/12 "2008-12-27T18:11:38Z")

</div>

Excellent, thank you for your very helpful reply.

Tim
