Has_many_polymorphs_plugin breaks routes

Just started playing with Engines (excellent work btw.) Anyways
everything was working fine in my plugin until I added
has_many_with_polymorphs plugin into the mix. Then all of a sudden my
routes are broken.

Everything works fine before adding this plugin and the plugin itself
works fine in other apps. I’ve also tried forcing engines to load
first but this doesn’t change the outcome.

Here are the relevant pieces of my logfile. If you want to see it in
action yourself please see our project website (railscart.org) and you
can grab the sourcecode. You will just need to add the
has_many_polymorphs to the starter application.



engines has started.
e[4;36;1mSQL (0.000000)e[0m e[0;1mSET SQL_AUTO_IS_NULL=0e[0m
e[4;35;1mSQL (0.000000)e[0m e[0mSELECT version FROM schema_infoe[0m
loading plugin from
./script/…/config/…/vendor/plugins/has_many_polymorphs with engine
** has_many_polymorphs: rails environment detected
** has_many_polymorphs: loaded ok
Plugin ‘has_many_polymorphs’: starting load.
Plugin ‘has_many_polymorphs’: loaded.
loading routes from
** has_many_polymorphs: autoload hook invoked
loading routes from
checking plugin ‘acts_as_paranoid’ for ‘application_helper’
checking plugin ‘engines’ for ‘application_helper’
checking plugin ‘has_many_polymorphs’ for ‘application_helper’
loading from application: application_helper

Processing ApplicationController#index (for at 2007-09-28
10:35:23) [GET]
Session ID: 06f8d68d3bcfb730b0ca982fecfdfe6c
Parameters: {}

ActionController::RoutingError (no route found to match
“/admin/categories/list” with {:method=>:get}):

Hi Sean,

The first step would be to figure out why the routing is failing -
what’s the entry in your routes file that should match
“/admin/categories/list” ? Do you have a complete sample app
(including your plugins) that demonstrates this failure?

  • James


Thanks for the response. I actually got this working yesterday. I
made several changes to my code to get the tests working and then I
decided to give HMP another spin and it worked.

The only change that I can think might have fixed this was adding my
plugins lib dir to the LOADPATH with

Rails.plugins[:railscart].code_paths << “lib”

I don’t know how this would have fixed things since my lib code is
completely unrelated to HMP. In fact, I wasn’t even referencing HMP
in my code yet (just trying to add it to my project and start it up.)

In any event. Its working now. Nice work on the engines plugin. I
think it will be ideal for our project.

You asked about sample code. Its actually an open source shopping
cart and there is a basic sample app in place (http://railscart.org.)
We’re also looking for some more volunteers to help with coding if the
project sounds interesting to you.