module Responders::CollectionResponder

def navigation_location


[@user, @post] #=> user_posts_url(@user.to_param)
[:admin, @post] #=> admin_posts_url

proper URL pointing to the index action.
When these new arrays are given to redirect_to, it will generate the

[@user, @post] #=> [@user, :posts]
[:admin, @post] #=> [:admin, :posts]

This method, converts the following resources array to the following:
Returns the collection location for redirecting after POST/PUT/DELETE.
def navigation_location
  return options[:location] if options[:location]
  klass = resources.last.class
  if klass.respond_to?(:model_name)
    resources[0...-1] << klass.model_name.route_key.to_sym
  else
    resources
  end
end