How to add dynamic routes to routes.rb. Worked in rails2 doesn't work in rails3

I've the following solution for this in rails2

In config/routes.rb

Page.all.each do |page|   map.connect page.url, :controller => p.controller, :action => p.action   # get page.url + ' => ' + p.controller+'#'+p.action end

This worked in rails2 but in rails3 this doesn't work anymore. I do get "rake routes" display my route but app.get('/test/page') doesn't work. I guess it has something to do with the parsing of my Page class, as not only map.method is relevant, but also any word inside that block.

Could somebody help?

best,

dennis

Do you have a typo and 'p.' needs to be replaced with 'page.'?

I works now, but I had to add the following to my config/route.rb

unfortunately the tests didn't find the routes:

  1) Error: test_should_get_about(PageControllerTest): ActionController::RoutingError: No route matches {:action=>"about", :controller=>"page"}     /test/functional/page_controller_test.rb:5:in `test_should_get_about'

$ rake routes RAILS_ENV=test (in xxx) page_index /page/index {:controller=>"page", :action=>"index"} page_about /page/about {:controller=>"page", :action=>"about"}

:-/

best, dennis