On Sep 20, 8:02 pm, "Commander Johnson" <[EMAIL PROTECTED]>
wrote:
> Hi,
> I've built the Admin section of my project first, and would like to move it
> to its own Admin namespace.
>
> I have four resources: Form, Element, Admin and User.
>
> Old URL would be:
>
> localhost:3000/forms
>
> New URL would be:
>
> localhost:3000/admin/forms
>
> How do I migrate from one namespace to another?
>
> After moving I want to create a second FormsController in the default
> namespace.
> I would then script/generate controller and script/generate view and modify
> as needed.
>
> Looking forward to hear your thoughts about this.
>
> CmdJohnson

Create a folder named "admin" in the following directories:

- app/controllers
- app/helpers
- app/views

Move the controllers, helpers and views which are to be namespaced to
the corresponding admin subdirectory.

You will need to edit the controllers that are namespaced. For
example:

Before: class FormsController < ApplicationController
After: class Admin::FormsController < ApplicationController

And do the same with your namespaced helpers.

Lastly, modify your routes.rb to reflect the namespaced resources:

map.namespace :admin do |admin|
  admin.resources :forms
  admin.resources :elements
  ...
end

HTH
--~--~---------~--~----~------------~-------~--~----~
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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to