Routeset mapper problem

hello,

I installed a rails app on dreamhost, which I’m building based on the
Comatose plugin, and it went smoothly for the first version.

Now I uploaded a second version where I broke down the Comatose code
into a regular rails app, which works alright locally, but can’t get
routing to work the same as before on the server. I believe I
double-checked all gotchas mentioned about rails deployment on the DH
wiki - such as permissions, checking that dispatch.fcgi runs on the
command-line, checking .htaccess, killing all dispatch processes before
reloading, checking logs (nothing), running webbrick… and no luck yet.
I get a simple file not found.

here’s the routing config I have

in /config/routes.rb I have:

map.content_root ‘’

and then there are two route_mappers, required from environment.rb,
which are loaded depending on the version of rails

in environment.rb:

if defined? ActionController::Routing::RouteSet::Mapper
require ‘support/route_mapper’
else
require ‘support/routes’
end

in /lib/support/routes.rb:

Adds the content_root mapping support to the Rails Routset

class ActionController::Routing::RouteSet
def content_root( path, options={} )
opts = {
:index => ‘’,
:layout => ‘content’,
:use_cache => ‘true’,
:cache_path => nil,
:force_utf8 => Comatose::Options.force_utf8.to_s,
:named_route=> nil
}.merge(options)
# Ensure the controller is aware of the mount point…
ContentController.add_root(path, opts[:index])
# Add the route…
opts[:controller] = ‘content’
opts[:action] =‘show’
route_name = opts.delete(:named_route)
unless route_name.nil?
named_route( route_name, “#{path}/*page”, opts )
else
if opts[:index] == ‘’ # if it maps to the root site URI, name it
content_root
named_route( ‘content_root’, “#{path}/*page”, opts )
else
connect( “#{path}/*page”, opts )
end
end
end

def method_missing( name, *args )
if name.to_s.starts_with?( ‘’ )
opts = (args.last.is_a?(Hash)) ? args.pop : {}
opts[:named_route] = name.to_s #[9…-1]
content_root( *(args << opts) )
else
(1…2).include?(args.length) ? named_route(name, *args) :
super(name, *args)
end
end

end

and

in /lib/support/route_mapper.rb

For use with ‘Edge Rails’

class ActionController::Routing::RouteSet::Mapper
def content_root( path, options={} )
opts = {
:index => ‘’,
:layout => ‘content’,
:use_cache => ‘true’,
:cache_path => nil,
:force_utf8 => Comatose::Options.force_utf8.to_s,
:named_route=> nil
}.merge(options)
# Ensure the controller is aware of the mount point…
ContentController.add_root(path, opts[:index])
# Add the route…
opts[:controller] = ‘content’
opts[:action] =‘show’
route_name = opts.delete(:named_route)
unless route_name.nil?
named_route( route_name, “#{path}/*page”, opts )
else
if opts[:index] == ‘’ # if it maps to the root site URI, name it
content_root
named_route( ‘content_root’, “#{path}/*page”, opts )
else
connect( “#{path}/*page”, opts )
end
end
end

def method_missing( name, *args, &proc )
if name.to_s.starts_with?( ‘’ )
opts = (args.last.is_a?(Hash)) ? args.pop : {}
opts[:named_route] = name.to_s #[9…-1]
content_root( *(args << opts) )
else
super unless args.length >= 1 && proc.nil?
@set.add_named_route(name, *args)
end
end
end

I’m at a loss over how to debug this… while I read up on routes, any
pointers or ideas would be greatly appreciated! :slight_smile:

thanks
Oliver

hi,

2006/8/3, Oliver B. [email protected]:

hello,

I installed a rails app on dreamhost, which I’m building based on the
Comatose plugin, and it went smoothly for the first version.

Now I uploaded a second version where I broke down the Comatose code
into a regular rails app, which works alright locally, but can’t get
routing to work the same as before on the server.

Do you have the same Rails version on both your development machine
and your host? (is it running from vendor/rails ?)

I get a simple file not found.

I don’t know comatose but… what is throwing the file not found?

anyhow if you are using edge, you may find helpful the routing
navigator plugin (
http://weblog.techno-weenie.net/2006/6/19/new-plugin-routing-navigator
).

bye
Luca