Gregy
Gregy

Reputation: 340

Rails model clarity

In advanced model we use a lot of includes, serializers, validations, callbacks, scopes, self.configs, relations, requires etc.

As all us know there is a "motto" - convention over configuration.
I was wondering if are there any conventions or good practices while working on model structure.

For example that relations should be placed on top of the model class, next should be validations etc.
Is there any convention how should I order everything before methods?

Upvotes: 0

Views: 35

Answers (1)

dipak gupta
dipak gupta

Reputation: 366

No there is not any convention like there is no such type of code ordering but it is a nice idea to define your code in a separate section like validations in one place etc...so that it provides you more code readability and it will be manageable for any future enhancement.

Upvotes: 1

Related Questions