# User + author in one model or not

**URL:** <https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674>\
**Category:** Rails\
**Created:** [December 15, 2008, 2:37pm UTC](https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674 "2008-12-15T14:37:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [December 15, 2008, 2:37pm UTC](https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674/1 "2008-12-15T14:37:15Z")

</div>

Hi everybody,

I am building some kind of social networking web. I have implemented  
user registration and now I would like to add another type of  
registration (authors). I dont know whether to keep the registration  
simple and add just a checkbox (user and author) and add a new column  
(user\_type) into the existing user table or build a new model  
Author to manage authors.

Thanks for your thoughts.  
Cheers  
Petr

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [December 15, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674/2 "2008-12-15T14:42:22Z")

</div>

Why does it need to be a type? What makes an author so different to  
make it different from a common user?

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

On Mon, Dec 15, 2008 at 10:37 AM, Petr B.

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [December 15, 2008, 3:01pm UTC](https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674/3 "2008-12-15T15:01:28Z")

</div>

I was planning to create subdomain for each author, so I want to  
seperate them from the normal users.

MaurÃ­cio Linhares wrote:

> Why does it need to be a type? What makes an author so different to  
> make it different from a common user?

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [December 15, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/user-author-in-one-model-or-not/155674/4 "2008-12-15T16:44:00Z")

</div>

Petr B. wrote:

> I was planning to create subdomain for each author, so I want to  
> seperate them from the normal users.
> 
> MaurÃ­cio Linhares wrote:
> 
> > Why does it need to be a type? What makes an author so different to  
> > make it different from a common user?

You could use a type column, and single table inheritance, but I suggest  
creating a separate Author model with its own authors table, and have a  
user\_id in that table. This way, an Author belongs\_to a User. All  
author-specific data goes in the authors table, and you can reuse all of  
your authentication with the User model.

Alternatively, users could have an author\_id, if that makes more sense.
