# Fat Data Model vs Skinny Data Model

**URL:** <https://www.ruby-forum.com/t/fat-data-model-vs-skinny-data-model/57144>\
**Category:** Rails\
**Created:** [April 7, 2006, 2:49pm UTC](https://www.ruby-forum.com/t/fat-data-model-vs-skinny-data-model/57144 "2006-04-07T14:49:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joenova](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c37758/32.png) [@joenova](https://www.ruby-forum.com/u/joenova)\
**Post date:** [April 7, 2006, 2:49pm UTC](https://www.ruby-forum.com/t/fat-data-model-vs-skinny-data-model/57144/1 "2006-04-07T14:49:07Z")

</div>

Ive recently been contemplating how to tackle allowing for extra  
“fields” to be added to a recordset. For example, a user has an email  
address, but they may also want to put their birthday, height, weight,  
etc. I don’t want to constrain what is possible in this situation. I  
think what I’m describing is best documented in Philip G.spun’s  
page here:

[http://philip.greenspun.com/seia/user-registration-and-management](http://philip.greenspun.com/seia/user-registration-and-management)

Now, I’m not entirely sure this is the best approach, I’m open to  
suggestions on how to deal with the situation. What I would like to  
know though is: Is this something that could be an extension of the  
ActiveRecord class? Lets say its called ActiveSkinnyRecord or  
something… is there a potential to make tables with this setup be  
just as easily dealt with as ActiveRecord does? Id be willing to give  
it a shot if it makes sense to others, and is doable. Please let me  
know your thoughts.

Joe N.

---

<div class="post-metadata">

**Author:** ![joenova](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c37758/32.png) [@joenova](https://www.ruby-forum.com/u/joenova)\
**Post date:** [April 7, 2006, 2:58pm UTC](https://www.ruby-forum.com/t/fat-data-model-vs-skinny-data-model/57144/2 "2006-04-07T14:58:23Z")

</div>

On 4/7/06, Joe N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ive recently been contemplating how to tackle allowing for extra  
> “fields” to be added to a recordset. For example, a user has an email  
> address, but they may also want to put their birthday, height, weight,  
> etc. I don’t want to constrain what is possible in this situation.

You have at least three strategies available that you can use right  
now without any futher additions to AR:

1.) Single Table Inheritance (admittedly not 100% what you’re looking  
for, but it’s worth a mention anyway)  
2.) has\_many :attributes, :as =\> :attributable (polymorphic  
relationship with a simple Attribute model)  
3.) serialize :attributes (where User#attributes is a Hash that is  
YAML’d into a TEXT column transparently.)

Go wild!

–

> **[Hendrik Mans](https://hendrik.mans.de/)**
>
> Hendrik Mans: Freelancer in Hamburg. Ruby on Rails, Elixir, Phoenix, JavaScript, React.js, Vue.js., Elm.

---

<div class="post-metadata">

**Author:** ![joenova](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c37758/32.png) [@joenova](https://www.ruby-forum.com/u/joenova)\
**Post date:** [April 7, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/fat-data-model-vs-skinny-data-model/57144/3 "2006-04-07T22:10:08Z")

</div>

> 2.) has\_many :attributes, :as =\> :attributable (polymorphic  
> relationship with a simple Attribute model)

Thanks Hendrik, I will check that out. I think the serialized way  
while it may be convenient would probably be a bad deal for general  
record finding/sorting… too bad cause that would be a real simple  
solution.

Joe
