Reputation: 334
I have used declartive_Authorization
in my app. But I want this is my rails engine as well without duplicating rules. Otherwise I have to use declartive_Authorization
in rail engine again but that won't be DRY concept.
Thanks in advance.
Upvotes: 1
Views: 71
Reputation: 1044
You just need to use your engine
name with Model
name in the authorization_rules.rb
file.
declarative_authorization
is work perfectly in rails engine
as well.
For ex:
In Rails engine
, there is one controller called
module MyEngine
class UsersController < ApplicationController
filter_resource_access collection: [:index]
end
end
so you defined rules as:
has_permission_on :my_engine_users, :to => [:index]
Upvotes: 1