POSTing in :admin namespace

I have a RESTful :admin namespace which works fine except for UPDATE and CREATE actions for the controllers in the :admin space. I am sure it is a namespace/routing issue and have looked through a bunch of posts but cannot find my error. In my Edit action I am getting:

The error occurred while evaluating nil.to_sym

in my Edit view for the line:

<% form_for(@user) do |f| %>

when I change this line to:

<% form_for([:admin, @user]) do |f| %>

I get:

undefined method `admin_admin_users_path' for #<ActionView::Base: 0x6c1838>

if I use:

<% form_for :user, @user do |f| %> or <% form_for :user, @user, :url => admin_user_path(@user.id) do |f| %>

I get:

Unknown action No action responded to 3

...what is wrong?!

My routes.rb:

< map.resources :posts map.resources :consignments

map.namespace :admin do |admin|    admin.resources :posts    admin.resources :consignments    admin.resources :users end

map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format'

My Admin::UsersController edit action:

< def edit    @user = Admin::Users.find(params[:id])    @page_title = @user.full_name    render :layout => 'admin/default' end

Thanks, Greg Oleksiak

Why is your model called Users and not User? Also, what is the purpose of namespacing this model? Models need not be namespaced, because there should be no difference between the namespaces.

Maybe a little quick tutorial on Admin Namespaces would be helpful. I'm in the planning stages of an application right now and would really like to add in an administration panel. Explain to me how to do this the best way from ground up. Maybe this will help our original poster.

Thanks Ryan. That cleared up my problems! I'm getting used to REST and assumed that the resource generate script would be reliable for models. Eddie, if your are on 2.0, I would still recommend using the generate scripts (script generate admin/user) but be careful as they are a very rough tool.

-Greg