

Put chubby models on a diet with concerns - Rails - andreiursan
http://37signals.com/svn/posts/3372-put-chubby-models-on-a-diet-with-concer

======
venus
I love DHH but passages like this "concern" me (lol):

> Here’s a Dropboxed concern that we mix into just the Person model

Right. So extracting a section of code into a mixin .. and then mixing it into
a single model? That's just moving the code elsewhere and using a fancy method
to inject it back in! It's not cleaning up anything!

For anyone interested in practical techniques to rethink, refactor and really
take the knife to your overweight models this post is a good start:
[http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-
decomp...](http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-
fat-activerecord-models/)

------
jasonwatkinspdx
Dupe of <http://news.ycombinator.com/item?id=4937917>

Looks like andreiursan just cut off a couple characters from the permalink
slug, which the 37s blog ignores, to get around the duplicate submission
detection.

------
krakensden
Clearly the opportunity to come up with a truly tasteless name was missed. I
await the fork eagerly.

------
amalag
From the API page
([http://api.rubyonrails.org/classes/ActiveSupport/Concern.htm...](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html))
it seems to do two things, 1\. resolve module dependencies 2\. eliminate some
ruby boilerplate in the module code.

I kind of liked the idea of extending the instances instead of including in
class, to add functionality to instances instead of all objects of the class,
but this keeps your model's fat, just the fat is distributed so it's not in
the model's single file.

