conditional root in routes.rb

I am trying to setup role based routing in my application. Something
similar to the following:

  map.root :controller => (authorize_admin? ? 'prospects' : 'welcome')

I am getting an error that authorize_admin? is not defined. It is
defined under lib directory and I can successfully call it from other
places in the application. How do you set up conditional root routes
for an application?

Thanks.

Bharat

I am trying to setup role based routing in my application. Something
similar to the following:

map.root :controller => (authorize_admin? ? 'prospects' : 'welcome')

I am getting an error that authorize_admin? is not defined.

Require the file from your lib dir, something like:

require "#{ RAILS_ROOT }/lib/foo.rb"