Skip to content

Comment on ActiveRecord (and Rails) Considered Harmful

Comments

"It took me two and a half years to realize that Ruby classes in the models folder don't have to inherit from ActiveRecord::Base. That is a problem."

Wow! Maybe you're the problem...

"ActionController relies on instance variables to pass information from the controller to the view. Have you ever seen a 200 line long controller method? I have."

Well I haven't, I've actually seen it in Django. Nothing forces you to write 200 lines controller methods.

"The whole idea of logic in templates leads to all kinds of problems."

Again, nothing forces to write a lot of logic in the views, you could write the minimum necessary.

If you haven't seen those kinds of controller methods, I'm wondering if you've worked on any legacy apps recently? I've yet to see an app with a) more than one or two skilled developers and b) more than a couple of years old that C) didn't exhibit that problem in at least a couple of spots. I don't think this is a Rails problem—its a code discipline problem. If you're fortunate enough to have only worked on solo projects or teams with extraordinary discipline, then I'm jealous! But its definitely a problem that creeps into most codebases sooner or later.

AboutSource Built by g1lg1l

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