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
4

1 回答 1

0

按照adamdunsonbundle exec rake routes的建议运行后,我发现我想要的是:

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

它正在使用文件夹publishers中的控制器。api

于 2013-02-26T01:40:36.293 回答