Skip to content

Comment on On logic in a Rails app, revisited 6 years later

Comments

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.

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.