# Named\_route error with edge 1.2 & theme\_support plugin

**URL:** <https://www.ruby-forum.com/t/named-route-error-with-edge-1-2-theme-support-plugin/80405>\
**Category:** Rails\
**Created:** [December 26, 2006, 3:17am UTC](https://www.ruby-forum.com/t/named-route-error-with-edge-1-2-theme-support-plugin/80405 "2006-12-26T03:17:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@mattman](https://www.ruby-forum.com/u/mattman)\
**Post date:** [December 26, 2006, 3:17am UTC](https://www.ruby-forum.com/t/named-route-error-with-edge-1-2-theme-support-plugin/80405/1 "2006-12-26T03:17:01Z")

</div>

Hi everyone!

Hope all had a good Christmas

I’ve just frozen edge rails 1.2 into my vendor/rails dir, and tried  
launching mongrel to test it, and got this:

C:\Documents and Settings\Matts\shop\>mongrel\_rails start  
\*\* Starting Mongrel listening at 0.0.0.0:3000  
\*\* Starting Rails with development environment …  
C:/Documents and  
Settings/Matts/shop/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:27:in  
`create_theme_routes': undefined method`named\_route’ for  
#ActionController::Routing::RouteSet:0x3374530 (NoMethodError) from  
C:/Documents and  
Settings/Matts/shop/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:13:in  
`draw' from C:/Documents and Settings/Matts/shop/config/../config/routes.rb:1 from C:/Documents and Settings/Matts/shop/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:487:in`load’ from C:/Documents and  
Settings/Matts/shop/config/…/vendor/rails/activer  
ecord/lib/…/…/activesupport/lib/active\_support/dependencies.rb:341:in  
`new_con stants_in' from C:/Documents and Settings/Matts/shop/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:487:in`load’ from C:/Documents and  
Settings/Matts/shop/config/…/vendor/rails/actionpack/lib/action\_controller/routing.rb:1151:in  
`load_routes!' from C:/Documents and Settings/Matts/shop/config/../vendor/rails/actionpack/lib/action_controller/routing.rb:1143:in`reload’ from C:/Documents and  
Settings/Matts/shop/config/…/vendor/rails/railties/lib/initializer.rb:287:in  
`initialize_routing' ... 9 levels... from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:83:in`run’ from  
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in  
`run’ from  
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel\_rails:235  
from c:/ruby/bin/mongrel\_rails:18

My understanding of that is that it can’t find the named\_route function  
in the actionpack/lib/actioncontroller/routing.rb file. The function is  
def. in that file :S

This is how it’s being called in the plugin

class ActionController::Routing::RouteSet

alias\_method :\_\_draw, :draw

# Overrides the default RouteSet#draw to automatically

# include the routes needed by the ThemeController

def draw  
old\_routes = @routes  
@routes = []

```
begin
  create_theme_routes
  yield self
rescue
  @routes = old_routes
  raise
end

write_generation
write_recognition

```

end

# Creates the required routes for the ThemeController…

def create\_theme\_routes  
# Added patch from D.J. Vogel that changes :filename to  
\*filename… allowing sub-folders  
named\_route ‘theme\_images’, “/themes/:theme/images/\*filename”,  
:controller=\>‘theme’, :action=\>‘images’  
named\_route ‘theme\_stylesheets’,  
“/themes/:theme/stylesheets/\*filename”, :controller=\>‘theme’,  
:action=\>‘stylesheets’  
named\_route ‘theme\_javascript’,  
“/themes/:theme/javascript/\*filename”, :controller=\>‘theme’,  
:action=\>‘javascript’

```
connect "/themes/*whatever", :controller=>'theme', :action=>'error'

```

end  
end

Sorry for the long post, but I wanted to include everything here so it  
was easier to help 😃

---

<div class="post-metadata">

**Author:** ![mattman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@mattman](https://www.ruby-forum.com/u/mattman)\
**Post date:** [January 20, 2007, 1:13pm UTC](https://www.ruby-forum.com/t/named-route-error-with-edge-1-2-theme-support-plugin/80405/2 "2007-01-20T13:13:49Z")

</div>

My temp solution for that is to empty routeset\_ex.rb, and copy all the  
routes in the file config/routes.rb:

#theme\_support  
map.connect “/themes/:theme/images/\*filename”, :controller=\>‘theme’,  
:action=\>‘images’  
map.connect “/themes/:theme/stylesheets/\*filename”,  
:controller=\>‘theme’, :action=\>‘stylesheets’  
map.connect “/themes/:theme/javascript/\*filename”,  
:controller=\>‘theme’, :action=\>‘javascript’

map.connect “/themes/\*whatever”, :controller=\>‘theme’,  
:action=\>‘error’

and it works well for me!
