Say I have the following controller and want to restrict :edit, :update, and :destroy to current_user's own foos.
class FooController < InheritedResources::Base
before_filter :login_required
respond_to :html
def show
@foo = Foo.find params[:id]
show!
end
protected
def collection
@foos ||= Foo.all
end
def begin_of_association_chain
current_user
end
end
My simple and perhaps naive question is: Can the above be refactored to look better? It feels like I'm overriding too much of inherited_resources.