<html><head></head><body bgcolor="#FFFFFF"><div>Yep we use it everywhere, I can't see a problem with it. <br><br>On 22 Mar 2012, at 12:31, Richard Taylor <<a href="mailto:richard@richt.co.uk">richard@richt.co.uk</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>
                <div>
                    I can see where they are coming from in the purist sense, but I find this pattern extremely useful and adopt it widely.  Until someone can come up with a better DRY example I'll be sticking to this.
                </div>
                <div><div><br></div><div>-- </div><div>Richard Taylor<br></div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Thursday, 22 March 2012 at 12:18, mudge wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Good afternoon all,</div><div><br></div><div>I posted this on Twitter a while back but seeing as the list has been</div><div>a flurry of activity recently, I thought I'd post it here to gather</div><div>more debate.</div><div><br></div><div>Do you use before_filters in your controllers to DRY up the</div><div>instantiation of variables like so?</div><div><br></div><div>class MyController < ApplicationController</div><div>  before_filter :load_model, :only => [:show, :edit, :update, :destroy]</div><div><br></div><div>  def show</div><div>  end</div><div><br></div><div>  def edit</div><div>  end</div><div><br></div><div>  private</div><div><br></div><div>  def load_model</div><div>    @model = Model.find(params[:id])</div><div>  end</div><div>end</div><div><br></div><div>It's a pattern that I've seen quite a bit and something we had taken</div><div>to using until a member of the team began challenging it during code</div><div>review. The gist of the issue is that he believed it to be an abuse of</div><div>filters which should really only deal with things like authentication;</div><div>it was his assertion that the actual loading of a model should be made</div><div>much more explicit.</div><div><br></div><div>The full discussion can be found at <a href="https://gist.github.com/2007669">https://gist.github.com/2007669</a></div><div>and I've added a few alternatives (including one inspired by the</div><div>latest Ruby Rogues discussion about Objects in Rails</div><div><a href="http://rubyrogues.com/046-rr-objects-in-rails-part-2/">http://rubyrogues.com/046-rr-objects-in-rails-part-2/</a>) but I'd be keen</div><div>to see what people here think and whether it is an issue or not.</div><div>_______________________________________________</div><div>Chat mailing list</div><div><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a></div><div><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>
            </div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Chat mailing list</span><br><span><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a></span><br><span><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a></span><br></div></blockquote></body></html>