Ruby on rails “类级方法”;“未定义”;

Ruby on rails “类级方法”;“未定义”;,ruby-on-rails,Ruby On Rails,代码如下: class TestController < ApplicationController wrap_parameters :test, format: [:json, :xml], include: self.test_method def self.test_method [ :one, :two, :three ] end end 这可能是因为您定义了一个方法“this_Is_a_test”,并试图将其引用为“test_method”?很抱歉!不,这

代码如下:

class TestController < ApplicationController
  wrap_parameters :test, format: [:json, :xml], include: self.test_method

  def self.test_method
    [ :one, :two, :three ]
  end
end

这可能是因为您定义了一个方法“this_Is_a_test”,并试图将其引用为“test_method”?很抱歉!不,这是我实际代码的简化,我错过了那个更改。固定的。
TestApp::Application.routes.draw do
  resources :subscriptions

  # API subdomain
  constraints subdomain: 'api' do
    get '/' => 'test#index'
    post '/create', to: 'test#create'
    get '/status', to: 'test#show'
  end

  # root route
  root to: 'pages#index'

  # User routes
  devise_scope :user do
    get 'login' => 'devise/sessions#new', :as => :new_user_session
    post 'login' => 'devise/sessions#create', :as => :user_session
    delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session

    get 'register' => 'devise/registrations#new', :as => :new_user_registration
    get 'profile' => 'devise/registrations#edit', :as => :edit_user_registration
    get 'users' => 'users/registrations#index'
  end
  devise_for :users, :skip => [:sessions], controllers: { registrations: 'users/registrations' }
end