by adamors · 12y ago · 0 comments
It is. The controller layer should be as dumb as possible, it shouldn't contain your (entire) application logic. It's a matter of single responsibility if anything.
Also, I find it very sad that we're still discussing the usefulness of the active record pattern. Other than convenience, it has none. It's a pain to maintain an application that uses it once it reaches a certain level of complexity.
And not just because of testability, it's a pain in the ass to replace/fine tune certain queries if you're calling active record methods in your controller.
tldr; I'm wondering how you actually do this. Firstly, in Rails, but other acceptable answers are "other technologies do it in this other way, which is better than how Rails does it for these reasons".
[0]: http://rom-rb.org/
I've got a post or two on my blog[0] (haven't updated it in awhile, but working on it!) and I just released a gem[1] to facilitate event-sourcing in ruby. Its young, but i've refined the api a bit from where I started a couple years ago (when it was just an experiment), and it has a much cleaner implementation now.
For more info about CQRS/ES and DDD in general, I recommend starting here[3] and lurking on the DDD mailing list[4]
[1] http://github.com/karmajunkie/replay
EDIT: dumb not dump.