오류: 상수 ApplicationController::CanCan이 초기화되지 않았습니다.

9197 단어 cancan

묘사

내가 보석을 써레질해 보았을 때: 설치:
$rake gems:설치
(/Users/tscolari/Projetos/skeleton에서)
라크 유산했어!
초기화되지 않은 상수 ApplicationController::CanCan
(-trace가 있는 작업을 실행하여 전체 추적을 보기)

토론 #1

시스템의 나머지 부분은 cancan이 있는 컨트롤러를 포함하여 정상적으로 작동합니다.더 이상 설치할 수 없어요.

토론 #2

추적은 무엇을 보여 줍니까?

토론 #셋

rake gems: 설치 - 추적
(/Users/tscolari/Projetos/skeleton에서)
*gems:install 호출(처음)
*gems:base 호출(처음)
*실행보석: 기지
* 호출 환경(처음)
** 실행 환경
라크 유산했어!
초기화되지 않은 상수 ApplicationController::CanCan
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:inconst_missing' /Users/tscolari/Projetos/skeleton/app/controllers/application_controller.rb:14 /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in 로딩,무 신 상수 표식'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:inload_file' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in의 새로운 상수
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:379:inload_file' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:259:in 요구 사항 또는 로드'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:inload_missing_constant' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst 실종'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:inconst_missing' /Users/tscolari/Projetos/skeleton/app/controllers/administration_controller.rb:1 /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in로드,무 신 상수 표식'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:inload_file' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in의 새로운 상수
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:379:inload_file' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:259:in 요구 사항 또는 로드'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:inload_missing_constant' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst 실종'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:inconst_missing' /Users/tscolari/Projetos/skeleton/vendor/plugins/rails-ckeditor/app/controllers/ckeditor_controller.rb:1 /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in 요구 사항
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in요구 사항
/사용자/tscolari/Projetos/skeleton/vendor/plugins/rails-ckeditor/init.rb:17:inevaluate_init_rb' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin.rb:158:inevaluate_init_rb'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active\u support/core\u ext/kernel/reporting.rb:11:insilence_warnings' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin.rb:154:inevaluate_init_rb'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin.rb:48:inload' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin/loader.rb:38:in 플러그인 로드
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin/loader.rb:37:ineach' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/plugin/loader.rb:37:in 플러그인 로드
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:369:inload_plugins' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:165:in 프로세스
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:insend' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:inrun'
/Users/tscolari/Projetos/skeleton/config/environment.rb:9
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 요구 사항
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in 새 상수
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.전보
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inrequire' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4 /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in마다'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in용 call chain'호출
/opt/local/lib/ruby/1.8/monitor.rb:242:inexecute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in용 call chain'호출
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:insynchronize' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in 호출
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:ininvoke' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/gems.rake:17 /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in마다'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in용 call chain'호출
/opt/local/lib/ruby/1.8/monitor.rb:242:inexecute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in용 call chain'호출
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:insynchronize' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in마다'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ininvoke_prerequisites' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in용 call chain'호출
/opt/local/lib/ruby/1.8/monitor.rb:242:ininvoke_prerequisites' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in용 call chain'호출
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:insynchronize' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in 호출 퀘스트'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ininvoke' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in표준이상처리
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in 실행
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:intop_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/local/bin/rake:19:in'load'
/opt/local/bin/rake:19
may cancangem 버전은 cancan(1.0.2)standard_exception_handling' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in입니다. 프로그램 컨트롤러의rescue from 자구 때문에 발생한 것으로 추정됩니다. 이 자구는 gm를 설치하지 않았을 때 터치됩니다.나는 인자를 문자열로 바꾸어야 할 수도 있다.기사 고마워요.

토론 #4

안녕, 리안, 나는 응용 프로그램 컨트롤러에'require'cancan'을 추가해서 이 오류를 없앴다.
... 첫 번째 답은 죄송합니다. 문제는 플러그인이 초기화되기 전에 프로그램 controler가 필요하다는 것입니다...다음은 제 솔루션입니다.
# 플러그인 보호
cancan=true
개시하다
내부 핵.콘스터
구조하다
cancan=false
끝맺다
하면, 만약, 만약...
칸칸에서 구출 | 예외 |
flash[:error] = "액세스가 거부되었습니다."
root url로 리디렉션
끝맺다
끝맺다

토론 #5

문구는 컨트롤러/모델 파일 이외에 저장하는 것이 좋으나 환경 설정 파일, 초기 값 설정 항목, bundler (사용하면) 내부에 저장하는 것이 좋습니다.어차피 이게 관례야.
만약 내가 오류를 정확하게 이해한다면,

토론 #6

부분을 require 의 문자열에 넣으면 그것을 복구할 수 있을 것이다.CanCan::AccessDenied 나는 이미 이 두 가지 해결 방안의 도움말과 효과를 테스트했다. 물론 문자열을 가진 해결 방안이 더 깨끗하다:)ApplicationController헤이,ryanb,
Application Controller

토론 #7

talhait07의 문자열에CanCan::AccessDenied 부분을 따옴표

토론 #8

만 붙이면 Puma를 다시 시작할 수 있습니다.

좋은 웹페이지 즐겨찾기