1

컨트롤러 Company :: Item in controller Security :: MyController에 액세스 중입니다. 그것은 초기화되지 않은 오류 Security :: Company :: Item을 제공합니다. 그래서 기본적으로 주어진 모델에 대해 'Security ::'을 추가합니다. 다른 모델에서는 Security :: User (동일한 모듈 보안의 모델)라고하지는 않습니다. 이것에 대한 가능한 설명은 무엇입니까?Ruby on rails : 모델 이름 초기화되지 않은 오류 (모듈 불일치)

+0

입니다 맥락에서 기본 범위를 적용에서 루비를 방지 할 수 ::를 앞에 덧붙이 루비 언어 사양

::Something is a shortcut for Object::Something. The idea is that ::Something should look up a constant called Something in the global scope, but since ruby doesn't truly have a global scope, it looks it up in the Object class, which is the nearest thing in ruby to a global scope. 

에 따르면 Security::MyController

내부 ::Company::Item를 사용하여 시도해야 문제의 코드를 게시 해주세요 – jschorr

답변

2

이것은 범위 분석 문제입니다. 당신은 당신의 경우, Security:: 범위

+0

정말 고마워요. –