# Finding controller relations in ActionController::Routing::R

**URL:** <https://www.ruby-forum.com/t/finding-controller-relations-in-actioncontroller-r/114812>\
**Category:** Rails\
**Created:** [September 17, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/finding-controller-relations-in-actioncontroller-r/114812 "2007-09-17T19:25:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emmanueloga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecae2f/32.png) [@emmanueloga](https://www.ruby-forum.com/u/emmanueloga)\
**Post date:** [September 17, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/finding-controller-relations-in-actioncontroller-r/114812/1 "2007-09-17T19:25:26Z")

</div>

Hi! my question is simple, the answer, i don’t know… Given this in  
routes.rb:

ActionController::Routing::Routes.draw do |map|  
map.resources :zones do |zone|  
zone.resources :customers  
end  
end

If i’m “standing” on CustomersController, how can i inspect  
ActionController::Routing::Routes to know that ZonesController is the  
controller for my parent resource?

Thank you.

---

<div class="post-metadata">

**Author:** ![emmanueloga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecae2f/32.png) [@emmanueloga](https://www.ruby-forum.com/u/emmanueloga)\
**Post date:** [September 17, 2007, 8:26pm UTC](https://www.ruby-forum.com/t/finding-controller-relations-in-actioncontroller-r/114812/2 "2007-09-17T20:26:33Z")

</div>

I have found a way to store resource information

$auto\_rest\_resources= []

class ActionController::Resources::Resource  
alias\_method :initialize\_before\_auto\_rest, :initialize

def initialize \*args  
initialize\_before\_auto\_rest(\*args)  
$auto\_rest\_resources \<\< self  
end  
end

is there any better way to do this?
