Forum: Ruby on Rails nested namespaces with nested resources

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
gzigzigzeo (Guest)
on 2008-11-26 13:56
(Received via mailing list)
Hello.

I have a problem with url_for resource.

My models:

class QuestionLibrary::Group < ActiveRecord::Base
class QuestionLibrary::Competence < ActiveRecord::Base
  set_table_name "question_library_competences"
  belongs_to :group
  has_many :questions
end

My controllers:
class Admin::QuestionLibrary::GroupsController < ApplicationController
class Admin::QuestionLibrary::CompetencesController <
ApplicationController

My routes:

map.namespace :admin do |admin|
  admin.namespace :question_library do |question_library|
    question_library.resources :groups, :collection => { :reoder
=> :post } do |groups|
      groups.resources :competences, :collection => { :reoder
=> :post } do |competences|
        competences.resources :questions
      end
    end
  end
end

My view:

<% form_for [:admin. @group, @competence] do |f| %>

fails with:

undefined method
`admin_question_library_group_question_library_competences_path'

In cause of url_for adds namespace prefix to each model. May I fix it
without specifying :url arg to url_for => ... ?
This topic is locked and can not be replied to.