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