# Rails 1.2 / Theme support plugin issue: Fix

**URL:** <https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794>\
**Category:** Rails\
**Created:** [March 6, 2007, 1:12am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794 "2007-03-06T01:12:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [March 6, 2007, 1:12am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/1 "2007-03-06T01:12:38Z")

</div>

This is to answer one of my old issues, that I was having using Theme  
support plugin using with Rails 1.2.

When you get an latest edge Rails update and run your application which  
has Theme support plugin you will get following error

/script/…/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:26:in  
`create_theme_routes': undefined method`named\_route’ for  
#ActionController::Routing::RouteSet:0x1313b78 (NoMethodError)  
from  
./script/…/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:13:in  
`draw’  
from ./script/…/config/…/config/routes.rb:1

Fix that I found for this is

# Go to vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb

# Replace “draw” method with following

def draw  
clear!  
create\_theme\_routes  
yield Mapper.new(self)  
named\_routes.install  
end

# In create\_theme\_routes method

- replace named\_route with add\_named\_route
- replace connect with add\_route

So your create\_theme\_routes should look like this

def create\_theme\_routes  
add\_named\_route ‘theme\_images’, “/themes/:theme/images/:filename”,  
:controller=\>‘theme’, :action=\>‘images’  
add\_named\_route ‘theme\_stylesheets’,  
“/themes/:theme/stylesheets/:filename”, :controller=\>‘theme’,  
:action=\>‘stylesheets’  
add\_named\_route ‘theme\_javascript’,  
“/themes/:theme/javascript/:filename”, :controller=\>‘theme’,  
:action=\>‘javascript’

```
add_route "/themes/*whatever", :controller=>'theme',

```

:action=\>‘error’  
end

This should do the trick. I have tested this on Rails 1.2.1 and 1.2.2

---

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [March 16, 2007, 7:38pm UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/2 "2007-03-16T19:38:13Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [April 3, 2007, 10:25am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/3 "2007-04-03T10:25:10Z")

</div>

Rajesh Shetty wrote:

> This is to answer one of my old issues, that I was having using Theme  
> support plugin using with Rails 1.2.
> 
> When you get an latest edge Rails update and run your application which  
> has Theme support plugin you will get following error
> 
> /script/…/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:26:in  
> `create_theme_routes': undefined method`named\_route’ for  
> #ActionController::Routing::RouteSet:0x1313b78 (NoMethodError)  
> from  
> ./script/…/config/…/vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb:13:in  
> `draw’  
> from ./script/…/config/…/config/routes.rb:1
> 
> Fix that I found for this is
> 
> # Go to vendor/plugins/theme\_support/lib/patches/routeset\_ex.rb
> 
> # Replace “draw” method with following
> 
> def draw

Thanks for Rajesh’s answer. But how about rails1.2.3, i got such error:  
=\> Booting WEBrick…  
d:/ruby/lib/ruby/site\_ruby/1.8/rubygems.rb:246:in `activate': can't activate rai ls (= 1.1.6), already activated rails-1.2.3] (Gem::Exception) from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:264:in`activate’  
from d:/ruby/lib/ruby/site\_ruby/1.8/rubygems.rb:263:in `each' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:263:in`activate’  
from  
d:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `re quire' from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_suppo rt/dependencies.rb:495:in`require’  
from  
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_suppo  
rt/dependencies.rb:342:in `new_constants_in' from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_suppo rt/dependencies.rb:495:in`require’  
from  
d:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/web  
rick.rb:52  
from  
d:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in `ge m_original_require' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`re  
quire’  
from  
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_suppo  
rt/dependencies.rb:495:in `require' from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_suppo rt/dependencies.rb:342:in`new\_constants\_in’  
from  
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_suppo  
rt/dependencies.rb:495:in `require' from d:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:3 9 from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`ge  
m\_original\_require’  
from  
d:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in `re  
quire’  
from script/server:3

Can you do me a favour?  
Regards.  
captain

> ```
> clear!
> create_theme_routes
> yield Mapper.new(self)
> named_routes.install
> 
> ```
> 
> end
> 
> # In create\_theme\_routes method
> 
> - replace named\_route with add\_named\_route
> - replace connect with add\_route
> 
> So your create\_theme\_routes should look like this
> 
> def create\_theme\_routes  
> add\_named\_route ‘theme\_images’, “/themes/:theme/images/:filename”,  
> :controller=\>‘theme’, :action=\>‘images’  
> add\_named\_route ‘theme\_stylesheets’,  
> “/themes/:theme/stylesheets/:filename”, :controller=\>‘theme’,  
> :action=\>‘stylesheets’  
> add\_named\_route ‘theme\_javascript’,  
> “/themes/:theme/javascript/:filename”, :controller=\>‘theme’,  
> :action=\>‘javascript’
> 
> ```
> add_route "/themes/*whatever", :controller=>'theme',
> 
> ```
> 
> :action=\>‘error’  
> end
> 
> This should do the trick. I have tested this on Rails 1.2.1 and 1.2.2

---

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [April 25, 2007, 7:51am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/4 "2007-04-25T07:51:28Z")

</div>

Sorry for real delayed answer. I have not played with Rails 1.2.3  
release yet. If I have any update for that I will post it here

---

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [July 19, 2007, 6:59am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/5 "2007-07-19T06:59:29Z")

</div>

But I have another question…

How do you get the layout part working?

For example, if a theme has a particular layout that I want to use…  
what do I need to fix in order to be able to use a theme’s layout?

Andy

---

<div class="post-metadata">

**Author:** ![openweb20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@openweb20](https://www.ruby-forum.com/u/openweb20)\
**Post date:** [July 14, 2007, 1:33am UTC](https://www.ruby-forum.com/t/rails-1-2-theme-support-plugin-issue-fix/87794/6 "2007-07-14T01:33:25Z")

</div>

Rajesh,

Thank you for posting this fix!  
I’ve been hitting problem after problem while learning how to use Ruby  
on Rails (and themes,) and this fixed my problem!

I’m using Rails 1.2.3 and the fix you described WORKS for Rails 1.2.3  
on Mac OS X (at least).  
Thanks again!

Andy

Rajesh Shetty wrote:

> Sorry for real delayed answer. I have not played with Rails 1.2.3  
> release yet. If I have any update for that I will post it here
