biddyweb / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

PATCH fix to allow route overriding #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Per the Engines documentation, the substruct/config/routes.rb file does not
facilitate overriding routes. I commented out the class definition as it
overrides all custom routes in your RAILS_ROOT/config/routes.rb. Also, I
removed all instances of "map." as it is not necessary in the Engines route
file.

For more info, have a look at the
engines/lib/engines/rails_extensions/routing.rb.

After copying substruct/config/routes.rb to the substruct plugin root, I
can now include:

map.from_plugin :substruct

in my RAILS_ROOT/config/routes.rb file to include default substruct routes
while maintaining custom routes.

Original issue reported on code.google.com by wes...@gmail.com on 26 Aug 2008 at 10:06

Attachments:

GoogleCodeExporter commented 9 years ago
Interesting, thank you.

Can you look at / modify the substruct.rake file to account for your new 
changes, and
how this should be handled when packaging a release? Relevant line is #216. 
Currently
we're advising copying the routes.rb file into the config directory. Looks like 
this
should be included with your map.from_plugin call.

If you can provide a patch that addresses that I'll roll it in ASAP.

Original comment by subim...@gmail.com on 26 Aug 2008 at 10:13

GoogleCodeExporter commented 9 years ago
Sure thing. I'll look into it.

Original comment by wes...@gmail.com on 26 Aug 2008 at 11:25

GoogleCodeExporter commented 9 years ago
Ok, I've modified the substruct.rake task to accommodate including the
map.from_plugin call into RAILS_ROOT/config/routes.rb. I also commented out the 
line
that copies the routes file to the freshly created rails project in favor of 
copying
it to the substruct engine root path. The file needs to be located here in 
order for
the map.from_plugin call to work properly.

I've ran the package command (rake substruct:release:package VERSION=1.0.a4) to 
test
that the routes.rb file gets modified properly and also, after untar'ing, the 
app
runs smoothly.

The map.from_plugin call is inserted as the first route. Hopefully, most people
should know that the route priority is based on the order in which they appear 
and
that if they wanted to make a route to another controller, they would put that 
before
the map.from_plugin call.

Original comment by wes...@gmail.com on 27 Aug 2008 at 1:19

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Cleaned things up and moved the location of the Substruct routes file so that 
extra
copying wouldn't be necessary.

Fixed r149

Original comment by subim...@gmail.com on 29 Aug 2008 at 4:28