Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve roles.yml file from Rails.root #968

Merged
merged 8 commits into from
Nov 25, 2024
2 changes: 2 additions & 0 deletions bullet_train-roles/lib/bullet_train/roles/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions bullet_train-roles/test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Loading