# From RPC to REST, quick design decision, need help

**URL:** <https://www.ruby-forum.com/t/from-rpc-to-rest-quick-design-decision-need-help/161006>\
**Category:** Rails\
**Created:** [February 22, 2009, 3:28am UTC](https://www.ruby-forum.com/t/from-rpc-to-rest-quick-design-decision-need-help/161006 "2009-02-22T03:28:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [February 22, 2009, 3:28am UTC](https://www.ruby-forum.com/t/from-rpc-to-rest-quick-design-decision-need-help/161006/1 "2009-02-22T03:28:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [February 22, 2009, 4:38am UTC](https://www.ruby-forum.com/t/from-rpc-to-rest-quick-design-decision-need-help/161006/2 "2009-02-22T04:38:50Z")

</div>

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/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

On Sat, Feb 21, 2009 at 11:27 PM, Marcelo de Moraes S.
