Marcelo de Moraes Serpa
2009-Feb-22 02:27 UTC
From RPC to REST, quick design decision, need help
Hello, Our app currently has an admin/logins/login_by_admin action. It basically allows the admin to login as a regular user of the system from the list of users in the backend. However, it clutters the logins controller. I was thinking on ways to clean up this design and make it more RESTful. One approach is to use the login.new action with an additional param (like from_admin = true). The other option is to turn login_by_admin into it''s own resource and put the logic into its new method. What do you think? Thanks, Marcelo. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
MaurĂcio Linhares
2009-Feb-22 03:38 UTC
Re: From RPC to REST, quick design decision, need help
Why isn`t admin just a role for a user instead of a completely different "kind" of user? If they were both the same, you woudn`t have any duplication at all and woudn`t need any special case logic. If you can''t do this, it''s better to have a separate resource to login admins, having a special user clause at the main user''s login controller isn`t great either. - MaurĂcio Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, Feb 21, 2009 at 11:27 PM, Marcelo de Moraes Serpa <celoserpa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Our app currently has an admin/logins/login_by_admin action. It basically > allows the admin to login as a regular user of the system from the list of > users in the backend. However, it clutters the logins controller. I was > thinking on ways to clean up this design and make it more RESTful. One > approach is to use the login.new action with an additional param (like > from_admin = true). The other option is to turn login_by_admin into it''s own > resource and put the logic into its new method. What do you think? > > Thanks, > > Marcelo. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---