7

I'm using cancan and cells gems in my ruby-on-rails project. How to access can? method from within cell? Thanks.

4

2 に答える 2

12

私はまさにこれをしなければなりませんでした。試す

class MyCell < Cell::Rails

  include CanCan::ControllerAdditions

end                                        

Devise も使用している場合は、次のようにする必要がありました。

class MyCell < Cell::Rails

  include CanCan::ControllerAdditions
  include Devise::Controllers::Helpers
  Devise::Controllers::Helpers.define_helpers(Devise::Mapping.new(:user, {}))

end                                        

#define_helperscurrent_user や user_signed_in などのヘルパー メソッドを追加しますか? セルに。

于 2011-10-19T10:30:29.503 に答える