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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Sun, Jun 8, 2008 at 10:15 AM, goleksiak <greg.oleksiak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > > > >-- Appreciated my help? Recommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Jun 8, 8:31 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. > > > > On Sun, Jun 8, 2008 at 10:15 AM, goleksiak <greg.oleks...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > -- > Appreciated my help? > Recommend me on Working With Railshttp://workingwithrails.com/person/11030-ryan-bigg--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Jun 8, 8:31 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. > > > > On Sun, Jun 8, 2008 at 10:15 AM, goleksiak <greg.oleks...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > -- > Appreciated my help? > Recommend me on Working With Railshttp://workingwithrails.com/person/11030-ryan-bigg--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---