Hello, there: My app has already generated default actions, like index, edit, update, create, etc. , on a namespace "admin" URL, the route is as follow. However, I haven''t figured out how to add new actions in class Admin::UsersController and matching it to the route.rb? For example I create a new action named "edit_role", what else I should put on route.rb so that the route will go and pick this action? Thanks! map.namespace :admin do |admin| admin.resources :tasks, :has_many => :comments admin.resources :users end Br, MyST --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
myst_tt wrote:> example I create a new action named "edit_role", what else I should > put on route.rb so that the route will go and pick this action?> map.namespace :admin do |admin| > admin.resources :tasks, :has_many => :comments > admin.resources :users > endadmin.resources :users, :member => { :edit_role => :get } or admin.resources :users, :collection => { :edit_role => :get } depending on how it is to be called (with an :id or without). For full details, see: http://api.rubyonrails.com/classes/ActionController/Resources.html#M000308 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks a lot! On 3月11日, 上午10时54分, Mark Bush <rails-mailing-l...@andreas-s.net> wrote:> myst_tt wrote: > > example I create a new action named "edit_role", what else I should > > put on route.rb so that the route will go and pick this action? > > map.namespace :admin do |admin| > > admin.resources :tasks, :has_many => :comments > > admin.resources :users > > end > > admin.resources :users, :member => { :edit_role => :get } > or > admin.resources :users, :collection => { :edit_role => :get } > > depending on how it is to be called (with an :id or without). > > For full details, see: > > http://api.rubyonrails.com/classes/ActionController/Resources.html#M0... > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---