How do we use Pundit helper methods inside of view components test .rb files? #1871
-
Here i am getting policy method not defined
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@niladrix719 is their a reason you closed this without an asnwer, if so could you post teh answer here for teh rest of teh community to benefit from. |
Beta Was this translation helpful? Give feedback.
-
also if you where having this issue the policy should be stored in helpers as is all global state, so you could either use |
Beta Was this translation helpful? Give feedback.
-
@reeganviljoen well i was not able to use pundit methods inside of view component , but it got solved after i added this two lines : include Pundit::Authorization
|
Beta Was this translation helpful? Give feedback.
@reeganviljoen well i was not able to use pundit methods inside of view component , but it got solved after i added this two lines :
include Pundit::Authorization
include Devise::Controllers::Helpers