rails-cells

How to access 'can?' method from within cell?

拟墨画扇 提交于 2019-12-21 02:17:30
问题 I'm using cancan and cells gems in my ruby-on-rails project. How to access can? method from within cell? Thanks. 回答1: I've had to do exactly this. Try class MyCell < Cell::Rails include CanCan::ControllerAdditions end If you're also using Devise, I had to do this: class MyCell < Cell::Rails include CanCan::ControllerAdditions include Devise::Controllers::Helpers Devise::Controllers::Helpers.define_helpers(Devise::Mapping.new(:user, {})) end #define_helpers will add helper methods such as

How to access 'can?' method from within cell?

半城伤御伤魂 提交于 2019-12-21 02:17:10
问题 I'm using cancan and cells gems in my ruby-on-rails project. How to access can? method from within cell? Thanks. 回答1: I've had to do exactly this. Try class MyCell < Cell::Rails include CanCan::ControllerAdditions end If you're also using Devise, I had to do this: class MyCell < Cell::Rails include CanCan::ControllerAdditions include Devise::Controllers::Helpers Devise::Controllers::Helpers.define_helpers(Devise::Mapping.new(:user, {})) end #define_helpers will add helper methods such as

How to access 'can?' method from within cell?

ぃ、小莉子 提交于 2019-12-03 07:13:50
I'm using cancan and cells gems in my ruby-on-rails project. How to access can? method from within cell? Thanks. I've had to do exactly this. Try class MyCell < Cell::Rails include CanCan::ControllerAdditions end If you're also using Devise, I had to do this: class MyCell < Cell::Rails include CanCan::ControllerAdditions include Devise::Controllers::Helpers Devise::Controllers::Helpers.define_helpers(Devise::Mapping.new(:user, {})) end #define_helpers will add helper methods such as current_user and user_signed_in? to the cell. For those who happen to have a custom current_ability() method (in