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
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#M000308
Thanks a lot!
On 3ÔÂ11ÈÕ, ÉÏÎç10ʱ54·Ö, Mark B. [email protected]