Recently, I was able to organize my code by combining everything into folders.
I had a problem with the same group name as for my controller group in the app/ directory and for my module in the lib/ directory, but I was able to fix it as follows:
Rails: name for library module and controller group?
I also know that whenever you change your lib code, you need to restart the rails server, which suits me completely.
But after a recent reorganization, every time I change the code in the controllers, I get the following error:
NameError at /admin uninitialized constant Admin::PagerDuty
and to resolve it, I just restart the server!
Any advice ?!
EDIT: STRUCTURE:
The controller main_controller.rb is under app/controllers/admin
class Admin::MainController < ApplicationController end
The main_helper.rb is under app/helpers/admin
module Admin::MainHelper require "admin/pager_duty.rb" def pager_duty pagerduty = Admin::PagerDuty.new() @on_call = pagerduty.on_call() @counts = pagerduty.open_incidents() end end
lib pager_duty.rb is under lib/admin
module Admin class PagerDuty .... end end
source share