Skip to content

Instantly share code, notes, and snippets.

@alekseyl
Last active March 31, 2021 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alekseyl/0afc3ec3285c37e0d5b8b24311b3a070 to your computer and use it in GitHub Desktop.
Save alekseyl/0afc3ec3285c37e0d5b8b24311b3a070 to your computer and use it in GitHub Desktop.
Active record structure
# Rails style guided+
#-------------------- 1. includes and extend --------------
#-------------------- 2. default scope --------------------
#-------------------- 3. inner classes --------------------
#-------------------- 4. constants ------------------------
#-------------------- 5. attr related macros --------------
#-------------------- 6. enums ----------------------------
#-------------------- 7. scopes ---------------------------
#-------------------- 8. has and belongs ------------------
#-------------------- 9. accept nested macros ------------
#-------------------- 10. validation ----------------------
#-------------------- 11. before/after callbacks ----------
#-------------------- 12. enums related macros ------------
#-------------------- 13. delegate macros -----------------
#-------------------- 14. other macros (like devise's)
#--------------------- should be placed after the callbacks
#-------------------- 15. public class methods -------------
#-------------------- 16. instance public methods ----------
#-------------------- 17. protected and private methods ----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment