# Admin's interface - the best way to implement

**URL:** <https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340>\
**Category:** Rails\
**Created:** [December 16, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340 "2007-12-16T19:21:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [December 16, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340/1 "2007-12-16T19:21:47Z")

</div>

One way is to create admin’s part within project’s folder using  
namespaces so that admin controllers are stored in app/controllers/  
admin/ and restrict access to these controllers for mere mortals using  
authentication. It means that both users and admins work with the same  
database, they share the same models, only the controllers are  
different.

The other way is to create another project totally dedicated to  
administration of the first, main project. So that models,  
controllers, logs, libraries (all that stuff) for admin’s project and  
the main project are stored in different folders (locally on the  
server). Admins have an access to the same models user have. Admins  
have an access to the database of the main project (which could be  
done in rails). Yet users don’t have an access to admin’s database  
(and even more so for controllers), since these are different  
databases, unlike the first way to implement this.

I slightly tend to implement it the second way. For security purposes.  
Namely, mere users and admins don’t share databases. Of course, admins  
need to authorize themselves to gain control to administration anyway,  
but, obviously, it’s secure, when the databases are separated from  
each other.

However, I believe, as always, both methods have their advantages and  
disadvantages. Yet I cannot foresee disadvantages of the second way,  
since this is the first time ever I’m trying to implement  
administration.

Which is the best way in your opinion? And what are the pros and cons  
of both ways?

Thanks.

---

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [December 16, 2007, 8:36pm UTC](https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340/2 "2007-12-16T20:36:14Z")

</div>

On Dec 16, 2007, at 10:21 AM, truetype wrote:

> the main project are stored in different folders (locally on the  
> each other.
> 
> However, I believe, as always, both methods have their advantages and  
> disadvantages. Yet I cannot foresee disadvantages of the second way,  
> since this is the first time ever I’m trying to implement  
> administration.
> 
> Which is the best way in your opinion? And what are the pros and cons  
> of both ways?

I do both depending on the application. When Admin functionality  
closely follows application functionality and is generally limited to  
CRUD and simplistic approval process functions, then I just build  
admin inline with the application.

However, when admin functionality starts to look like a completely  
different application because of the way data must be combined for  
review, reports, business logic more complex than simple approvals,  
and especially when the UI demands go beyond simple list & record  
views, then I build a separate application because at that point it  
really is a separate application due to differing UI, organization,  
logic, etc.

IMO there’s no real security advantage to either structure.

–  
def gw  
acts\_as\_n00b  
writes\_at(www.railsdev.ws)  
end

---

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [December 16, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340/3 "2007-12-16T21:03:51Z")

</div>

Thanks for your answer.

How about deployment? I’ve never deployed ror application to date, so  
the deployment itself could become an experience for me, let alone  
simultaneous deployment of two applications. Is there any difference  
or do any challenges arise, when you deploy application and its admin  
part?

Thanks.

---

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [December 21, 2007, 8:14am UTC](https://www.ruby-forum.com/t/admins-interface-the-best-way-to-implement/123340/4 "2007-12-21T08:14:58Z")

</div>

If you had two different applications, why would you have two  
different databases? It seems like it would be a mess because you  
would have to specify the connection type for some of the models.  
Wouldn’t it make sense just to use the same database and models, and  
just have separate everything else? You could synchronize the Models  
folder using source control, so you wouldn’t have to repeat any of  
that functionality across the two apps.

You would then need to specify all the routes, but you’re doing that  
anyways, because you’re using resources, right? 😉
