Hacker News new | ask | show | jobs
by revskill 2582 days ago
Sharing business logic between models/controllers/views often leads to a mess.

There's a reason to just write business logic code at only ONE place, the controller.

You'll thank yourselves years later when you revisited your code. Just one place to look for.

2 comments

Long term controllers being fat will give you headaches if you want to provide an api for different platforms (mobile, another web)
But placing logic in the controllers means you need to get a rails controller to test your business logic. This may seem fine in a small application, but as an app grows it becomes a headache to need to tie all your business rules to your framework.

“Rails is not your application”

If "Rails it not your application", why use Rails then ?
It’s a set of libraries that work great together, it’s pretty easy to learn, and lots of people know Rails.