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 singleton 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
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 singleton 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
This methods gets your begin_of_association_chain, join it with your
 parents chain and returns the scoped association.