I'm in the process of organizing my code, so far I have successfully managed to groupcontrollers/helpers/views
in folders "admin", but I used to have originally a library with the same module name "admin" that I'm not being able to call anymore. (name conflict?)
The new structure:
Directory Structure
-> app
-> controllers
-> admin #new
-> admin_main
-> admin_permissions
-> Helpers
-> admin #new
-> admin_main_helper
-> admin_permissions_helper
-> lib
-> admin
-> pagerduty.rb
I used to be able to call my library from my helpers like this:
module Admin::AdminMainHelper #admin:: is new
require "./lib/admin/pagerduty.rb"
def pager_duty
pagerduty = Admin::PagerDuty.new() #throws error after the new structure
@on_call = pagerduty.first_on_call()
@counts = pagerduty.open_incidents()
end
end
The error is "uninitialized constant Admin::PagerDuty"
Do I have to rename my library to something else? or is there a way around this?
EDIT: It works if I rename my library module to "AdminLib" instead of "Admin" for example. So the question is if there is a way around this.