diff --git a/bullet_train-incoming_webhooks/config/models/roles.yml b/bullet_train-incoming_webhooks/test/dummy/config/models/roles.yml similarity index 100% rename from bullet_train-incoming_webhooks/config/models/roles.yml rename to bullet_train-incoming_webhooks/test/dummy/config/models/roles.yml diff --git a/bullet_train-roles/lib/bullet_train/roles/engine.rb b/bullet_train-roles/lib/bullet_train/roles/engine.rb index 6d1079a7b..a74ef93fd 100644 --- a/bullet_train-roles/lib/bullet_train/roles/engine.rb +++ b/bullet_train-roles/lib/bullet_train/roles/engine.rb @@ -4,6 +4,8 @@ class Engine < ::Rails::Engine config.eager_load_paths << Role.full_path initializer "bullet_train-roles.config" do |app| + Role.set_root_path("#{Rails.root}/config/models") + role_reloader = ActiveSupport::FileUpdateChecker.new([Role.full_path]) do Role.reload(true) end diff --git a/bullet_train-roles/test/dummy/config/application.rb b/bullet_train-roles/test/dummy/config/application.rb index 942eef9e6..4d5842d70 100644 --- a/bullet_train-roles/test/dummy/config/application.rb +++ b/bullet_train-roles/test/dummy/config/application.rb @@ -30,8 +30,5 @@ class Application < Rails::Application config.generators.system_tests = nil config.factory_bot.definition_file_paths += [File.expand_path("../../factories", __dir__)] if defined?(FactoryBotRails) - - Role.set_root_path("config/models") - Role.set_filename("roles") end end diff --git a/bullet_train-roles/test/dummy/config/initializers/bullet_train-roles.rb b/bullet_train-roles/test/dummy/config/initializers/bullet_train-roles.rb deleted file mode 100644 index c97574385..000000000 --- a/bullet_train-roles/test/dummy/config/initializers/bullet_train-roles.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -Role.class_eval do - set_root_path "test/dummy/config/models" - set_filename "roles" -end diff --git a/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb b/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb index 1114efec1..c1fe254ba 100644 --- a/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb +++ b/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb @@ -483,7 +483,7 @@ def add_scaffolding_hooks_to_model def add_ability_line_to_roles_yml(class_names = nil) model_names = class_names || [child] - role_file = "./config/models/roles.yml" + role_file = "#{Rails.root}/config/models/roles.yml" roles_hash = YAML.load_file(role_file) default_role_placements = [ [:default, :models], diff --git a/bullet_train/config/models/roles.yml b/bullet_train/test/dummy/config/models/roles.yml similarity index 100% rename from bullet_train/config/models/roles.yml rename to bullet_train/test/dummy/config/models/roles.yml