I''m migrating my app from Rails 2.3.8 to Rails 3.0.0 . But
I''ve
problems in converting my routes.rb which looks like this:
ActionController::Routing::Routes.draw do |map|
map.namespace(:admin) do |admin|
admin.resources :participants
admin.resources :communities, :has_many => :participants
admin.resources :organizations
end
map.resources :memberships, :only => [:index]
begin
RessourceData.all.each do |r|
map.resources r.ressource.to_sym, :path_prefix =>
''/''+r.namespace,
:name_prefix => r.namespace+''_'', :controller =>
''messages'',
:only => [:index, :show, :create, :update, :destroy],
:collection => { :fifo => [:get, :post], :lifo =>
[:get, :post] }
end
rescue ActiveRecord::StatementInvalid
Rails.logger.info "DB error: #{$!}"
end
end
With this code I''m able to do dynamic routing: the dynamic routes
where build out of the RessourceData model.
I''ve tried to convert these routes into Rails3 routes like this:
Ecs2::Application.routes.draw do
namespace :admin do
resources :participants
resources :communities, :has_many => :participants
resources :organizations
resources :ressources
end
resources :memberships, :only => [:index]
begin
RessourceData.all.each do |r|
namespace r.namespace.to_sym do
resources r.ressource.to_sym, :controller =>
''messages'', :only
=> [:index, :show, :create, :update, :destroy] do
collection do
get ''fifo''
post ''fifo''
get ''lifo''
post ''lifo''
end
end
end
end
rescue ActiveRecord::StatementInvalid
Rails.logger.info "DB error: #{$!}"
end
But generated routes out of the RessourceData model aren''t correct,
because the responsible controller is generated like "r.namespace/
r.ressource" instead of just "messages", e.g.
"vip/exercises" instead of simply "messages"
Any suggestions ?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.