Skip to content

Commit

Permalink
Merge pull request #968 from bullet-train-co/fixes/roles-file-resolut…
Browse files Browse the repository at this point in the history
…ion-redux

Resolve `roles.yml` file from `Rails.root`
  • Loading branch information
jagthedrummer authored Nov 25, 2024
2 parents 5950cae + a915ee2 commit d4f47ce
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 10 deletions.
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
File renamed without changes.

0 comments on commit d4f47ce

Please sign in to comment.