Rails Best Practices
When the business logic of models becomes complex, it's very helpful to keep a consistent code structure that is agreed by team members.
the routes will become complicated with the growth of your application, contain different namespaces, each with a lot of resources and custom routes, it would be better to split routes into different files according to the namespaces, which makes it easy to maintain the complicated routes.
If you use rails generator to create scaffolds or controllers, it will also create some helpers, most of the helpers are useless, just remove them.implemented
Are you tired of going to schema.rb to find your table structures information? It would be better to list all the attributes of the model in the model itself.
If you want to process something expensive as part of a web request, it will delay the response. If the job is not critical, it's wiser to move the expensive to a background queue and returns the response immediately.
Ruby/Rails provides a lot of magic codes, especially for metaprogramming, they are powerful, less codes to implement more functions, but they are not intuition, you should write good comment for your magic codes.
Like the simplify render in views, from rails 2.3, we can also simplify render in controllers.implemented