Refactor Rails models using Concerns
Rails developers like to repeat some phrase like “Convetion Over Configuration”, “Fat Model, Skinny Controller” or “Don’t Repeat Yourself”. Today I am going to focus on the last one: how we can minimze the repeated code in your models using Concerns
.
[Here write more about concerns]
https://discuss.rubyonrails.org/t/helping-devs-understand-concerns-faster/74619/22?u=software_writer
To read: https://codeclimate.com/blog/7-ways-to-decompose-fat-activerecord-models/ https://reactjs.org/blog/2016/07/13/mixins-considered-harmful.html https://www.rubypigeon.com/posts/rails-models-bloated-should-i-use-concerns/ https://www.cloudbees.com/blog/when-to-be-concerned-about-concerns
Questions from forum: “What do you get by extending ActiveSupport::Concern?” “Why is there a different name in rails for a mixins?” “When are we using concerns”
Recent posts:
Few thoughts on programming career
I’ve just read “Software Craftmanship” authored by Sandro Marcuso. It gave me some thoughts on my career, few ideas that I wish I would hear earlier.
Read More
Master Git tools - Effective Programmer pt. 2
Learn about the importance of writing a good commit messages. How to use message templates, hooks, aliases and how to navigate Git history like a pro.
Read More
Taking notes for productivity - Effective Programmer pt. 1
Organizing knowledge is a key factor of effective programming work. Is taking notes the perfect way to do it? I think yes answering all of the why and how questions.
Read More
Few thoughts on programming career
I’ve just read “Software Craftmanship” authored by Sandro Marcuso. It gave me some thoughts on my career, few ideas that I wish I would hear earlier.