module InheritedResources::BaseHelpers

def end_of_association_chain #:nodoc:

:nodoc:

parents chain and returns the scoped association.
This methods gets your begin_of_association_chain, join it with your
def end_of_association_chain #:nodoc:
  if chain = association_chain.last
    if method_for_association_chain
      apply_scopes_if_available(chain.send(method_for_association_chain))
    else
      # This only happens when we specify begin_of_association_chain in
      # a singletion controller without parents. In this case, the chain
      # is exactly the begin_of_association_chain which is already an
      # instance and then not scopable.
      chain
    end
  else
    apply_scopes_if_available(resource_class)
  end
end