Emmanuel Oga
2007-Sep-17 17:25 UTC
Finding controller relations in ActionController::Routing::R
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Emmanuel Oga
2007-Sep-17 18:26 UTC
Re: Finding controller relations in ActionController::Routin
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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---