Jose said that instead of using inherited resources we should use Rails 3 responders, but they seem to me not so handy. I am wondering which is the best thing to do.<br><br><div class="gmail_quote">On 23 March 2012 11:26, Ash Berlin <span dir="ltr"><<a href="mailto:ash_lrug@firemirror.com">ash_lrug@firemirror.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"><br>
On 22 Mar 2012, at 12:50, Jay Caines-Gooby wrote:<br>
<br>
> On 22 March 2012 12:18, mudge <<a href="mailto:mudge@mudge.name">mudge@mudge.name</a>> wrote:<br>
>> Good afternoon all,<br>
>><br>
>> I posted this on Twitter a while back but seeing as the list has been<br>
>> a flurry of activity recently, I thought I'd post it here to gather<br>
>> more debate.<br>
>><br>
>> Do you use before_filters in your controllers to DRY up the<br>
>> instantiation of variables like so?<br>
>><br>
>> class MyController < ApplicationController<br>
>> before_filter :load_model, :only => [:show, :edit, :update, :destroy]<br>
><br>
> resource_this <a href="https://github.com/jnewland/resource_this" target="_blank">https://github.com/jnewland/resource_this</a> does exactly<br>
> this and we use it extensively. It means that you get extremely terse<br>
> controllers for basic CRUD, and you can customise them really easily<br>
> for additional flexibility.<br>
><br>
> I also like the helper_method style<br>
> <a href="https://gist.github.com/2007669#file_helper_method_controller.rb" target="_blank">https://gist.github.com/2007669#file_helper_method_controller.rb</a><br>
><br>
> The main problem with any of these, is that in basic controllers, the<br>
> signpost of a 'helper_method :model' or 'resource_this' at the top of<br>
> the controller are easy to spot, but add in all your validation code,<br>
> relationships, etc, etc they can be easy to miss, but the DRYness of<br>
> them certainly makes it worthwhile.<br>
<br>
<br>
</div>inherited_resources does both of these automatically (s/model/resource/ for the helper method) - <a href="http://github.com/josevalim/inherited_resources/" target="_blank">http://github.com/josevalim/inherited_resources/</a><br>
<br>
After having a quick glance at resource_this inherited_resources seems to largely similar but might be easier to override behaviour on one action (though I only glanced at the docs for r_t quickly)<br>
<span class="HOEnZb"><font color="#888888"><br>
-ash<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Riccardo Tacconi<br>Ruby on Rails and PHP development - System Administration<br>VIRTUELOGIC LIMITED<br><br><a href="http://github.com/rtacconi" target="_blank">http://github.com/rtacconi</a><br>
<a href="http://riccardotacconi.blogspot.com" target="_blank">http://riccardotacconi.blogspot.com</a><br><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a><br>