Class: Para::Acl::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/para/acl/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_role_mixin_to_adminObject



11
12
13
14
15
16
17
18
19
# File 'lib/generators/para/acl/install/install_generator.rb', line 11

def add_role_mixin_to_admin
  admin_user_class_file_path = File.join(
    'app', 'models', "#{ Para.config.acl.admin_user_class.underscore }.rb"
  )

  inject_into_file admin_user_class_file_path, after: /< (ActiveRecord::Base|ApplicationRecord)/ do
    "\n  has_admin_role"
  end
end

#add_role_to_super_adminsObject



21
22
23
# File 'lib/generators/para/acl/install/install_generator.rb', line 21

def add_role_to_super_admins
  rake 'para:acl:authorize_admins'
end

#install_migrationsObject



6
7
8
9
# File 'lib/generators/para/acl/install/install_generator.rb', line 6

def install_migrations
  rake 'para_acl_engine:install:migrations'
  rake 'db:migrate'
end