개인 방법을 사용해 보십시오

8946 단어 cancan

묘사

여보세요,
나는 캔캔을 사용해 보려고 한다. 내가'캔?'을 사용해 보기만 하면'사유 방법을 사용해 보자'는 이상이 발생한다.'안 돼요?'또는 내 코드 중 어느 곳에서 자원을 불러오고 권한을 부여합니다.
환경:
궤도
당면한 고비
무슨 생각 있어요?
여기다
Jens

토론 #1

코드에서 사용하는 곳은?당신은 창고 추적을 제공할 수 있습니까?

토론 #2

통조림 쓸까요?색인에 직접 있습니다.html.직원 재교육국
<@training\u types의 교육 유형에 대한%>
...
<% 가능하면?:업데이트, 교육 유형%><%= "편집"에 링크, 교육 유형 경로 편집(교육 유형)%><%end%>
...
<%end%>
다음은 스택 추적입니다.
activemodel (3.0.4) lib/active_model/attribute_methods.rb:404:in `guard_private_attribute_method!'
activerecord (3.0.4) lib/active_record/attribute_methods.rb:43:in `method_missing'
app/models/ability.rb:6:in `initialize'
cancan (1.5.1) lib/cancan/controller_additions.rb:327:in `new'
cancan (1.5.1) lib/cancan/controller_additions.rb:327:in `current_ability'
cancan (1.5.1) lib/cancan/controller_additions.rb:350:in `can?'
actionpack (3.0.4) lib/abstract_controller/helpers.rb:55:in `can?'
app/views/training_types/index.html.erb:13:in `block in _app_views_training_types_index_html_erb___1573392073323099758_17217885300__4101780282840520985'
app/views/training_types/index.html.erb:8:in `each'
app/views/training_types/index.html.erb:8:in `_app_views_training_types_index_html_erb___1573392073323099758_17217885300__4101780282840520985'
actionpack (3.0.4) lib/action_view/template.rb:135:in `block in render'
activesupport (3.0.4) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.4) lib/action_view/template.rb:127:in `render'
actionpack (3.0.4) lib/action_view/render/rendering.rb:59:in `block in _render_template'
activesupport (3.0.4) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.4) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.4) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.4) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.4) lib/abstract_controller/rendering.rb:115:in `_render_template'
actionpack (3.0.4) lib/abstract_controller/rendering.rb:109:in `render_to_body'
actionpack (3.0.4) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.4) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.4) lib/abstract_controller/rendering.rb:102:in `render_to_string'
actionpack (3.0.4) lib/abstract_controller/rendering.rb:93:in `render'
actionpack (3.0.4) lib/action_controller/metal/rendering.rb:17:in `render'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.0.4) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/lib/ruby/1.9/benchmark.rb:309:in `realtime'
activesupport (3.0.4) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.0.4) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.0.4) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.4) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.4) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.4) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.4) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.4) lib/active_support/callbacks.rb:435:in `_run__4287118475465037523__process_action__894027563519154169__callbacks'
activesupport (3.0.4) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.4) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.4) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.4) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.4) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.4) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.4) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.4) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.4) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.4) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.4) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.4) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.4) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.4) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.4) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.4) lib/action_dispatch/routing/route_set.rb:492:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.4) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.4) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.4) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.4) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.4) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.4) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.4) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.4) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.4) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.4) lib/rails/application.rb:168:in `call'
railties (3.0.4) lib/rails/application.rb:77:in `method_missing'
railties (3.0.4) 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/handler/webrick.rb:52:in `service'
/usr/local/lib/ruby/1.9/webrick/httpserver.rb:111:in `service'
/usr/local/lib/ruby/1.9/webrick/httpserver.rb:70:in `run'
/usr/local/lib/ruby/1.9/webrick/server.rb:183:in `block in start_thread'

토론 #셋

The private method call is happening on line 6 in the Ability class. Can you post that?

토론 #4

class Ability
  include CanCan::Ability

  def initialize(user)
    user ||= User.new # guest user (not logged in)
    if user.role? :admin
      can :manage, :all
    end
  end
end
그러나 나는 사용자 모델의'private'키워드 아래에 캐릭터 내용을 추가하는 방법을 방금 발견했다.나는 그것들을 높게 올렸다. 이제 그것은 일을 할 수 있다
고맙습니다.

토론 #5

멋있어요. 성공하셔서 반갑습니다.이거 닫아.

좋은 웹페이지 즐겨찾기