Administrative Functions: Best Practices?

I'd like to second this question... I was searching around before posting this question myself. I have seen posts like this online, http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails - saying that you shouldn't use namespacing. What would doing it using rails routes look like instead?

Thoughts?

Chris Bloom wrote: > So is "module" just another term for the namespace approach that has > been mentioned above? Can anyone provide an example of using this?

I believe so. The biggest reason namespacing controllers is often frowned upon is that it can add unnecessary complexity to your app.

Yes. Modules and namespaces are synonymous. I've posted a sample application at http://dev.panesofglass.org/projects/contacts.zip. This app is using a contacts namespace to enclose a PeopleController and CompaniesController. I can't get the functional tests to work, so any help there would be appreciated. The good news is that you can indeed create nested resources now.

> And even though DHH's post re: Rails 2.0 has some text that points to a > new solution, what is a viable solution for the 1.x line?

The simplest thing you can do with 1.x is:

<code> map.resources :whatever, :path_prefix => '/admin' </code>

That's definitely the easiest approach. It lets you continue to use all the regular methods of referencing paths and urls without having to edit every object, @object, object_path or object_url reference in your app. Of course, if you're going for a more modular approach and you don't scaffold then you probably don't mind writing that from scratch.

As to my testing issues, I think my solution will be to use RSpec, which I've already planned to use in the future. However, if you want to use the built in testing system, not sure what to tell you. I'd still be interested to see if anyone knows how to write tests for namespaced controllers.