2013-02-25 2 views
0

URL이 있습니다 : http://api.mysite.com/api/v3/publishers/somepublisher.json?callback=mysite.publisherLoaded 그리고 액세스 할 수있는 메서드를 추적하려면 노력하고있어. 응답은 publisherLoaded 콜백으로 묶인 JSON 문자열입니다.레일스에서 ​​루트가 치는 컨트롤러를 추적하는 방법은 무엇입니까?

아무도 나를 추적 할 수있는 방법을 안내 할 수 있습니까?

routes.rb 오히려 큰, 그래서 붙여 넣은 관련 세그먼트 :

API_OPTIONS = {:requirements => {:api_version => /v(1|2|3)/}} unless Object.const_defined?(:API_OPTIONS) 

ActionController::Routing::Routes.draw do |map| 

    map.namespace :api, API_OPTIONS.merge(:path_prefix => '/api/:api_version') do |api| 
    api.resources :apps, :member => {:authenticate => :get} 
    api.resources :foreign_currencies 
    api.resources :designers 

    api.resources :publishers, API_OPTIONS.merge(:has_many => [:user_sessions, :products], :member => {:login => :get, :authenticate => :get}) do |publisher| 
     publisher.resources :app_earning_constraints 
     publisher.resource :charts, API_OPTIONS 
     publisher.resource :reports, API_OPTIONS 
     publisher.resources :rules, API_OPTIONS  
     publisher.resources :sales, API_OPTIONS.merge(
     :collection => { :current => :get } 
    ) 

    # Generic App Scoped Services 
    map.namespace :api, API_OPTIONS.merge(:path_prefix => '/api/:api_version/app/:app_id', :name_prefix => 'api_app_') do |api| 
     api.resources :publishers, API_OPTIONS.merge(:has_many => [:aisles], :member => {:login => :get}) do |publisher| 
     publisher.resources :users, API_OPTIONS.merge(:member => {:authenticate => :post}) do |user| 
      user.resource :app_state, API_OPTIONS.merge(:controller => 'user_app_states') 

      # Used to generate a session from OAuth data (OpenSocial integrations) 
      user.resources :sessions, API_OPTIONS 

     end    

     publisher.resources :application_events, 
      :as => 'events', 
      :only => :none, 
      :collection => { :install => :post, :uninstall => :post } 

     publisher.resources :credit_transfer_pricepoints, API_OPTIONS 
     end 
    end 
    end 

    # Dynamic javascripts 
    map.connect 'javascripts/*javascript.plain.js', :controller => 'javascripts', :action => 'show', :format => 'js', :requirements => {:javascript => /#{Dir['app/views/javascripts/**/*.js.erb'].map {|s| s[22..-8]} * '|'}/} 
    map.connect 'javascripts/*javascript.js', :controller => 'javascripts', :action => 'show', :format => 'js', :requirements => {:javascript => /#{Dir['app/views/javascripts/**/*.js.erb'].map {|s| s[22..-8]} * '|'}/} 


    # Administration Site 
    map.with_options(:controller => 'admin/site') do |admin_site| 
    admin_site.admin_default 'admin', :action => 'index' 
    admin_site.admin_home 'admin/home', :action => 'index' 
    end 


    map.notfound '*url', :controller => 'error', :action => 'notfound' 
end 
+1

'routes.rb'가 이에 대해 무엇을 말하고 있습니까? – jdl

+1

또한 '레이크 루트'는 무엇이라고 말합니까? – adamdunson

+0

원래 질문에 'routes.rb'를 추가했습니다. – Shamoon

답변

0

adamdunson에 의해 제안 bundle exec rake routes를 실행 한 후, 나는 내가 원하는 것을 것을 발견했다 :

GET /api/:api_version/publishers/:id(.:format) {:controller=>"api/publishers", :action=>"show"}

api 폴더에있는 publishers 컨트롤러를 사용하고있었습니다.

관련 문제