Rails are constructed on the principle of convention over configuration. Simply put, this suggests that, by default, Rails assumes that its professional developers can follow “standard” best observe conventions and, if you do, things can work for you “automagically” while not your desperate to specify these details. whereas this paradigm has its benefits, it is also not without its pitfalls.
There are some Common Mistakes That Rails Developers Make:
The problem is that the controller object can begin to violate the one responsibility principle creating future changes to the code base troublesome and fallible. Generally, the only types of logic you must have in your controller are:
The out-of-the-box Rails templating engine, ERB, maybe a good way to create pages with variable content. However, if you’re not careful, you'll be able to presently find yourself with an outsized file that's a combination of hypertext markup language and Ruby code that may be tough to manage and maintain. this is often additionally a locality that may result in numerous repetitions, resulting in violations of DRY (don’t repeat yourself) principles.
Many Rails developers truly build the error and find themselves sticking out everything in their ActiveRecord model categories resulting in Mongolian monetary unit files that not solely violate the only responsibility principle however also are a maintenance nightmare.
The only logic that should remain in your model is:
While most Rails developers are aware of the default log files accessible throughout development and in production, they typically don’t pay enough attention to the knowledge in those files. whereas several applications have faith in log observation tools like Honeybadger or New Relic in production, it's conjointly necessary to stay an eye fixed on your log files throughout the method of developing and testing your application.
Excessive use of gems makes the scale of a Rails method larger than it has to be. this could cut down performance in production. additionally to user frustration, this could additionally lead to the necessity for larger server memory configurations and enlarged operation prices. It additionally takes longer to begin larger Rails applications, which makes development slower and makes machine-driven tests take longer (and as a rule, slow tests merely don’t get run as often).