Hacker News new | ask | show | jobs
by metaphorm 4772 days ago
do you find the Interactor pattern preferable to implementing a different re-use pattern for Controllers though? Why not use, for example, use Abstract Controllers and just include them as a Mixin to your Controllers.

e.g. CommentMixin would be an abstract controller class that is included in any controller that has an object that can be commented on.

1 comments

Interactors are not always triggered by a user event. Many of our interactors are triggered by a scheduled job or some other system process that doesn't touch a controller.

Also, as the article describes, interactors are plain old ruby objects, so are straightforward to test. An Abstract Controller, being a Rails construct, would require you to jump through some Rails hoops to test.