Class: JkoApi::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/jko_api/util.rb

Class Method Summary collapse

Class Method Details

.eager_load_api_controllersObject



9
10
11
12
13
14
15
16
# File 'lib/jko_api/util.rb', line 9

def self.eager_load_api_controllers
  [Rails.root.join('app', 'controllers')].each do |load_path|
    matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/
    Dir.glob("#{load_path}/#{JkoApi.configuration.api_namespace}/**/*.rb").sort.each do |file|
      require_dependency file.sub(matcher, '\1')
    end
  end
end

.stupid_hack!Object



4
5
6
7
# File 'lib/jko_api/util.rb', line 4

def self.stupid_hack!
  Rails.application.reload_routes!
  eager_load_api_controllers
end