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 #698

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gazayas
Copy link
Contributor

@gazayas gazayas commented Nov 27, 2023

Closes #688.

As a side note, I didn't add #{Rails.root} the following lines because it was throwing an error when trying to run migrations in the starter repository:

set_root_path "config/models"
set_filename "roles"

Role.set_root_path("config/models")
Role.set_filename("roles")

set_root_path is an ActiveHash method, and it looks like it already looks for a yml file based off of the root path. This can be inferred from the following in the documentation:

By default, this class will look for a yml file named "countries.yml" in the same directory as the file. You can either change the directory it looks in, the filename it looks for, or both:

class Country < ActiveYaml::Base
  set_root_path "/u/data"
  set_filename "sample"
end

The above example will look for the file "/u/data/sample.yml".

@gazayas
Copy link
Contributor Author

gazayas commented Nov 27, 2023

Since we're currently out of CI credits I ran the super scaffolding tests locally and everything's working fine.

@gazayas gazayas marked this pull request as ready for review November 27, 2023 10:32
@jagthedrummer
Copy link
Contributor

Hmmm... this looks like it should work, but it doesn't seem to change anything. The tests are still passing with this change, but I'd expect them to fail since the fixture file would be in the wrong place. Just to confirm I pulled down this branch and tried moving the fixture file into the dummy app where it should go, and then the tests fail due to not being able to find the file.

Webhooks::Incoming::BulletTrainWebhooksControllerTest
  test_should_get_incoming_webhook                               ERROR (0.46s)
Minitest::UnexpectedError:         Errno::ENOENT: No such file or directory @ rb_sysopen - config/models/roles.yml

@jagthedrummer jagthedrummer marked this pull request as draft March 11, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better resolution for config/models/roles.yml
2 participants