Hi there,

What is the usual way to let a user modify his own data and the admin to
edit and view the data of all users.

I could do:

1) create a Person model with a route
resources :people

that works fine, if I check the permissions for :admin and non admin
accounts.

but for a user I have the /person/334/edit route.  But for the user
which is not an admin, I'd like not to have this id in the route.

so I

2) routed like this:

namespace :admin do
    resources :people
end
namespace :user do
    resoures :people
end

but then I have two controllers, can I put this together as one?

and another problem:  there is no redirect_to @person , which is also
bad, maybe I could get it work in the model, checking if an admin or a
user should be redirected to @person.

What is the usual way to fix the user edits his own, and the admin edits
all data?

Thanks,
Martin

-- 
Lösungen statt Diagnosen

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/87twly6d08.fsf%40kaffanke.at.
For more options, visit https://groups.google.com/d/optout.

Reply via email to