In the namespace “music” I have artists, styles and labels, where
artists also acts as namespace containing types:
map.namespace :music do |music|
music.resources :artists
music.namespace :artists do |artists|
artists.resources :types
end
music.resources :styles
music.resources :labels
end
On Fri, Mar 21, 2008 at 12:28 AM, Joshua M. [email protected] wrote:
map.namespace :music do |music|
music.resources :artists
music.namespace :artists do |artists|
artists.resources :types
end
music.resources :styles
music.resources :labels
end
Sniffer from the docs:
{{{
namespace(name, options = {}, &block)
Enables the use of resources in a module by setting the name_prefix,
path_prefix, and namespace for the model. Example:
map.namespace(:admin) do |admin|
admin.resources :products,
:has_many => [ :tags, :images, :variants ]
end
This will create admin_products_url pointing to “admin/products”,
which will look for an Admin::ProductsController. It’ll also create
admin_product_tags_url pointing to
“admin/products/#{product_id}/tags”, which will look for
Admin::TagsController.
}}}
you’re using the plural.
most likely that’s it. otherwise it’s more likely, that types or type is
a ruby keyword than artists.
oops, just realize, you’re using a namespace, that’s the same name as a
controller, that most likely won’t work…
Surprisingly this really was the problem. I changed it to the singular
form, and now it works perfectly. So it seems not to be any problem to
nest namespaces and resources.
Thanks you guys!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.