db-S
June 7, 2010, 9:53pm
1
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
db-S
June 8, 2010, 10:31am
2
Do you have a typo and ‘p.’ needs to be replaced with ‘page.’?
db-S
June 8, 2010, 11:38am
3
I works now, but I had to add the following to my config/route.rb
require ‘arel’
require ‘active_model’
require ‘active_model/observing’
Otherwise my route got added but no route at all will work.
app.get(‘/page/about’) AND app.get(‘/’) resulted in unintialized
constants error.
best,
dennis
Am 08.06.2010 um 10:29 schrieb pepe:
get page.url + ’ => ’ + p.controller+‘#’+p.action
best,
dennis
–
You received this message because you are subscribed to the Google G. “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected] .
To unsubscribe from this group, send email to [email protected] .
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .
Dennis Berger
Informatik
email: [email protected]
mobile: +491791231509
fon: +494054001817
db-S
June 8, 2010, 11:47am
4
unfortunately the tests didn’t find the routes:
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
Am 08.06.2010 um 11:36 schrieb dennis berger:
app.get(‘/page/about’) AND app.get(‘/’) resulted in unintialized constants error.
Do you have a typo and ‘p.’ needs to be replaced with ‘page.’?
end
Informatik
email: [email protected]
mobile: +491791231509
fon: +494054001817
–
You received this message because you are subscribed to the Google G. “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected] .
To unsubscribe from this group, send email to [email protected] .
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .
Dennis Berger
Informatik
email: [email protected]
mobile: +491791231509
fon: +494054001817