Sterling Rose Design Blog
Model Component Ordering
Authored by Dana Jones
May 15, 2009 02:19
2 Comments
Tags: Rails community
Leave a Comment
Authored by Dana Jones
May 15, 2009 02:19
2 Comments
Tags: Rails community
On a whim, I asked (in IRC and via Twitter) what order – given validators, accessors, and associations – developers typically listed these components in their models. As far as I know there is no compelling reason to use one order over the other (but feel free to correct me in the comments). Even so, it can be fun to know what other developers do.
I had 19 responses, broken down as follows:
Accessors | Associations | Validators = 20%
Accessors | Validators | Associations = 5%
Associations | Accessors | Validators = 20%
Associations | Validators | Accessors = 45%
Validators | Accessors | Associations = 5%
Validators | Associations | Accessors = 0%
CommentsI had 19 responses, broken down as follows:
Accessors | Associations | Validators = 20%
Accessors | Validators | Associations = 5%
Associations | Accessors | Validators = 20%
Associations | Validators | Accessors = 45%
Validators | Accessors | Associations = 5%
Validators | Associations | Accessors = 0%
I list them alphabetical. Which by nature ends up ordering them roughly in accessors, associations, validators
Posted August 10, 2009 by Michael Deering
Posted August 10, 2009 by Michael Deering
Leave a Comment


As far as compelling reasons, I dont think there are any, I guess its more personal style really.
Posted May 15, 2009 by modsognir