

The problem with this is that the controller object will start to violate the single responsibility principle, making future changes to the codebase difficult and prone to errors. It’s all too easy to move view logic (which is better housed in a helper), or domain/model logic, into the controller. In the Rails community, we’ve been talking about fat model, skinny controller for a while, yet several recent Rails applications I’ve inherited violate this principle. Common Rails Programming Mistake #1: Overloading the Controller With Logic
#Thinner vs fatter ar rails how to
This tutorial looks at 10 common Ruby on Rails coding problems and shows you how to avoid them and the issues that they cause. It can also have undesirable ramifications with regard to security and performance.Īccordingly, Rails is easy to use-and equally easy to misuse. The magic that happens behind the scenes in the framework can sometimes lead to developer confusion. While this paradigm has its advantages, it is not without its pitfalls and leaves the door open for developers to make common Rails programming mistakes. Rails is built on the principle of convention over configuration and promises a favorable outcome to expert developers who follow best practice conventions. Ruby on Rails (Rails) is a popular open-source framework, based on the Ruby programming language that strives to simplify and streamline the web application development process. It has been modified to include recent sources and to align with our current editorial standards. Editor’s note: This article was updated on by our editorial team.
