-
Notifications
You must be signed in to change notification settings - Fork 111
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
Added external lib folder to autoload path #3307
Conversation
…ded into OnDemand
Why not use initializers in Also shouldn't |
I am not aware of any other location in |
I guess I'll have to check this out to see what you mean - it seems to me you can define/redefine anything in an initializer - so defining a new SmartAttribute in an initializer seems doable. Or is it that you need to load a library, say |
When I tried, any require statement for a class that is located inside initializer will result in class not found error. # initializers/smart_attributes.rb
module SmartAttributes
require 'smart_attributes/attributes/bc_aday'
end And created the SmartAttribute under: I did the same with the changes in this PR and adding these files under: |
Can you share the smart attribute you are trying to use? I just tried with this as an initializer and the form did recognize the Maybe you needed to wrap it in a |
OK - the way you implemented the This way will work and I can adapt my ruby code to be all in one class, but I cannot create multiple ruby classes in multiple files and use regular require to load them if created in the |
OK, Let me think on this. On the one hand - yes being able to add any ruby library is powerful - on the other ... that power can cause issues or vulnerabilities. Let me think on it for a bit and see what we can do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya know, I think I'm coming around to this. I see all sorts of hacks around the same.
That said - I think you can require '/full/path/to/the/file'
.
In any case, we can move on this.
In IQSS, we have 2 custom BatchConnect templates that require 2 ruby classes in an specific lib folder.
We are currently adding these 2 ruby files into the installed OnDemand lib folder:
/var/www/ood/apps/sys/dashboard/lib
under the expected path:/ood_core/batch_connect/templates/
We would like support to load these classes from the external config root to keep all customizations and overrides together as well as not modify the dashboard file structure.
We might develop as well custom SmartAttributes and this will help to deploy them