0

레일 프로젝트의 모델 용 API 컨트롤러가 있습니다. 다음과 같이레일 컨트롤러 네임 스페이스/모듈 구성

이 API 컨트롤러는 다음과 같습니다 만들 때

#app/controllers/api/v1/airbnb/customers_controller.rb 
module Api 
    module V1 
    class CustomersController < Api::V1::BaseApiController 
     def create 
     @airbnb_customer = Airbnb::Customer.new 
     @json_request['airbnb_customer']['client_id'] = @client.id 
     update_values :@customer, @json_request['airbnb_customer'] 
     end 
    end 
    end 
end 

문제는 오는 airbnb_customer 새로운 : 제가 적용되는 API를 :: V1 범위를 방지하는 방법을 모른다

NameError in Api::V1::Airbnb::CustomersController#create 
uninitialized constant Api::V1::Airbnb::Customer 

전화 할 때 Airbnb::Customer.new 도움을 주시면 대단히 감사하겠습니다.

내 모델은 app/models/airbnb.rbapp/models/airbnb/customer.rb입니다.

답변

1

추가 : 에어 비앤비 네임 스페이스 트리의 '루트'를 액세스한다, 그래서 당신은

::Airbnb::Customer.new 
+0

완벽한을 추가해야하기 전에, 감사합니다! 내가 왜 내가 그 정보를 찾을 수 없었는지 모르겠다. – natemacinnes