<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 4:48 PM, Andrew Premdas <span dir="ltr"><<a href="mailto:apremdas@gmail.com" target="_blank">apremdas@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im HOEnZb">On 18 March 2014 15:50, Mike Kelly <<a href="mailto:mikekelly321@gmail.com">mikekelly321@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> On Tue, Mar 18, 2014 at 3:42 PM, Andrew Premdas <<a href="mailto:apremdas@gmail.com">apremdas@gmail.com</a>> wrote:<br>
>><br>
>> Some questions/points:<br>
>><br>
>> 1. Why can't the controllers be the RailsAdapter?<br>
><br>
><br>
> The main reason I've found this doesn't work is because Rails controllers<br>
> tend to be responsible for handling many different CRUD actions over a<br>
> collection. If you're adhering to tell don't ask this leads to controllers<br>
> that have a huge public interface, because they need to have a callback<br>
> method for handling each potential outcome for every action. By breaking out<br>
> the callback methods for each action into decorators, you avoid this problem<br>
> and group each action's callbacks together.<br>
><br>
> Cheers,<br>
> M<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">Surely having actions with lots of potential outcomes is just poor<br>
design anyhow. Rails is a RESTful web framework and controllers used<br>
resftully will provide at most 8 methods to work with a particular<br>
resource. Most of these methods should only have one outcome, index,<br>
new, show, edit just show something (anything else is exceptional);<br>
update, create, delete have two outcomes success:failure. If you<br>
follow the anti-pattern of having one controller dealing with all the<br>
actions to a collection/model you'll be abusing Rails even if you use<br>
hexagonal rails.<br></div></div></blockquote><div><br></div><div>There are a couple of problems here. In general, if your app is complex enough that rails conventions are becoming painful it seems more likely that mutative actions may have more than just success/fail outcomes. Also, by rails conventions, public methods on a controller are assumed to be routable-to actions - any callback methods you put on your controllers will defy this convention. You will probably need to introduce some kind of grouping convention for the callbacks to a given action. There is also the issue of collisions in the names of the callbacks, which will force you to prefix them with the action name i.e. `update_success` instead of just `success`.</div>
<div><br></div><div>Btw, I'm not advocating for the style here - I'm just sharing my experience having applied it.</div><div><br></div><div>Cheers,</div><div>M</div></div></div></div>