ApplicationController의load 와authorize 자원은Deviate에 적용되지 않습니다
7211 단어 cancan
프로그램의 모든 컨트롤러를 보호하려고 했습니다. 그래서 프로그램 컨트롤러에 '불러오기와 권한 부여 자원' 을 추가했습니다.그러나 현재 etc에 로그인하기 위한 작업은 작동하지 않습니다.다음은 내 로그의 항목입니다.
Started GET "/users/sign_in" for 127.0.0.1 at 2010-09-01 00:38:31 +0200
Processing by Devise::SessionsController#new as HTML
Completed in 9ms
NameError (uninitialized constant Session):
Rendered C:/Users/vita/.pik/rubies/Ruby-192-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered C:/Users/vita/.pik/rubies/Ruby-192-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (91.0ms)
Rendered C:/Users/vita/.pik/rubies/Ruby-192-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (109.0ms)
스택을 호출하는 방법:activesupport (3.0.0) lib/active_support/inflector/methods.rb:124:in `block in constantize'
activesupport (3.0.0) lib/active_support/inflector/methods.rb:123:in `each'
activesupport (3.0.0) lib/active_support/inflector/methods.rb:123:in `constantize'
activesupport (3.0.0) lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
cancan (1.3.3) lib/cancan/controller_resource.rb:83:in `resource_class'
cancan (1.3.3) lib/cancan/controller_resource.rb:100:in `resource_base'
cancan (1.3.3) lib/cancan/controller_resource.rb:54:in `build_resource'
cancan (1.3.3) lib/cancan/controller_resource.rb:46:in `load_resource_instance'
cancan (1.3.3) lib/cancan/controller_resource.rb:30:in `load_resource'
cancan (1.3.3) lib/cancan/controller_resource.rb:24:in `load_and_authorize_resource'
cancan (1.3.3) lib/cancan/controller_resource.rb:9:in `block in add_before_filter'
activesupport (3.0.0) lib/active_support/callbacks.rb:446:in `_run__192464393__process_action__1059523234__callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.0) lib/action_controller/metal.rb:133:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal.rb:173:in `block in action'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:27:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/mapper.rb:34:in `call'
rack-mount (0.6.12) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.12) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.12) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.12) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.12) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:492:in `call'
warden (0.10.7) lib/warden/manager.rb:35:in `block in call'
warden (0.10.7) lib/warden/manager.rb:34:in `catch'
warden (0.10.7) lib/warden/manager.rb:34:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/cookies.rb:287:in `call'
activerecord (3.0.0) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.0) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.0) lib/rails/application.rb:168:in `call'
railties (3.0.0) lib/rails/application.rb:77:in `method_missing'
railties (3.0.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/chunked.rb:15:in `call'
rack (1.2.1) lib/rack/handler/mongrel.rb:67:in `process'
mongrel-1.2.0.pre2-x86 (mingw32) lib/mongrel.rb:165:in `block in process_client'
mongrel-1.2.0.pre2-x86 (mingw32) lib/mongrel.rb:164:in `each'
mongrel-1.2.0.pre2-x86 (mingw32) lib/mongrel.rb:164:in `process_client'
mongrel-1.2.0.pre2-x86 (mingw32) lib/mongrel.rb:291:in `block (2 levels) in run'
써볼게요.skip_before_filter :load_and_authorize_resource
디자인-1.1.2\app\controllers\디자인\sessions\u controller에서하지만 성공하지 못했다.좀 도와주시겠어요?Vit
묘사
는 Application Controller에서 사용하는 것을 권장하지 않습니다토론 #1
.이것은 컨트롤러마다 각각 완성해야 합니다. 왜냐하면 사용자 정의 행동을 위해 옵션을 전달해야 할 수도 있기 때문입니다.또한 모든 컨트롤러가 RESTful인 것은 아니며 Desive 컨트롤러의 문제입니다.원인
load_and_authorize_resource
이 작용하지 않는 것은before 필터에 이름이 없기 때문입니다. 이것은 건너뛸 수 없는 블록을 통해서만 완성됩니다.실수로 컨트롤러를 잃어버릴까 봐 걱정하신다면 135호를 참고하여 도움말 추가에 대한 토론을 보십시오.
Reference
이 문제에 관하여(ApplicationController의load 와authorize 자원은Deviate에 적용되지 않습니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://github.com/ryanb/cancan/issues/138텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)