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

properly prepend ProvisioningTemplate class with helper #28

Merged
merged 1 commit into from
May 17, 2024

Conversation

laugmanuel
Copy link
Member

No description provided.

@laugmanuel
Copy link
Member Author

@evgeni
Copy link

evgeni commented May 17, 2024

This looks like Ruby. I never understood how Ruby's ClassMethods and prepend and include and everything works.

#yolo?

@laugmanuel
Copy link
Member Author

It's at least tested locally and it works. I needed a few tries myself. Prepending class methods is just magic...

@laugmanuel
Copy link
Member Author

I'll also add a test for that later before merging..

@evgeni
Copy link

evgeni commented May 17, 2024

Can you see if #29 also solves it?
No idea what's cleaner, poking around singleton_class or your prepended override.

@laugmanuel laugmanuel force-pushed the fix/templates_by_kind_not_found branch from 81c39ca to 350d757 Compare May 17, 2024 18:24
@laugmanuel
Copy link
Member Author

Can you see if #29 also solves it? No idea what's cleaner, poking around singleton_class or your prepended override.

Your solution also worked. I simplified it even more and added a test for it. This now looks like a good solution to me.

@laugmanuel laugmanuel force-pushed the fix/templates_by_kind_not_found branch from 350d757 to c45e253 Compare May 17, 2024 18:26
@laugmanuel laugmanuel changed the title fixes error during settings rendering because method is not found properly prepend ProvisioningTemplate class with helper May 17, 2024
fixes error during settings rendering because method is not found
@laugmanuel laugmanuel force-pushed the fix/templates_by_kind_not_found branch from c45e253 to bcdf635 Compare May 17, 2024 18:26
@evgeni
Copy link

evgeni commented May 17, 2024

Interesting. I thought ClassMethods would be some magic name…

@laugmanuel
Copy link
Member Author

I'll go with this PR as we use the same here in git_templates: https://github.com/dm-drogeriemarkt/foreman_git_templates/blob/master/lib/foreman_git_templates/engine.rb#L34

Tests are passing and fix is verified locally - merging...

@laugmanuel laugmanuel merged commit 07e1001 into master May 17, 2024
46 checks passed
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.

2 participants