Click here to Skip to main content
15,886,763 members
Articles / Programming Languages / Ruby

Using Rails Service Objects to Keep Code Clean

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
29 Aug 2022CPOL8 min read 13.8K   6  
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
If you're developing web apps using Ruby on Rails, you probably already know that Rails is an MVC (Model-View-Controller) framework, which means that you have your Models responsible for data, Views responsible for templates and Controllers responsible for requests handling. But the bigger your app gets, the more features it has - the more business logic you will have. And here comes the question, where do you put your business logic? Obviously, it's not views that should handle it. Controllers or Models? That will make them fat and unreadable pretty soon. That's where Service Objects come to the rescue. In this article, we'll learn about Service Objects and how to use them to make your app cleaner and keep it maintainable.

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Russian Federation Russian Federation
Aleksandr Ulanov is a Full Stack Software Engineer. He started web development in 2012 and gained strong knowledge and expertise in the field over time. He's now an internationally recognized expert in Ruby programming language, who constantly contributes his knowledge to the industry.

Comments and Discussions