Skip to content

Commit

Permalink
Move RoutesLoadedFile into its own file.
Browse files Browse the repository at this point in the history
This fixes an autoload issue, that happens if RoutesLoadedFile is
loaded/accessed before LoadedFile (resulting in uninitialized constant
error).
  • Loading branch information
thedarkone committed May 6, 2015
1 parent 15ebc37 commit 10b426d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
1 change: 1 addition & 0 deletions lib/rails_development_boost.rb
Expand Up @@ -53,6 +53,7 @@ def self.supports_reload_classes_only_on_change?
autoload :ReferenceCleanupPatch, 'rails_development_boost/reference_cleanup_patch'
autoload :Reloader, 'rails_development_boost/reloader'
autoload :RequiredDependency, 'rails_development_boost/required_dependency'
autoload :RoutesLoadedFile, 'rails_development_boost/routes_loaded_file'
autoload :ViewHelpersPatch, 'rails_development_boost/view_helpers_patch'

def self.debug!
Expand Down
24 changes: 0 additions & 24 deletions lib/rails_development_boost/loaded_file.rb
Expand Up @@ -287,28 +287,4 @@ def current_mtime
File.mtime(@path).to_i rescue nil
end
end

class RoutesLoadedFile < LoadedFile
def decorator_like?
false
end

def changed?
false
end

def schedule_consts_for_unloading!
Reloader.routes_reloader.force_execute!
end

def add_constants(new_constants)
end

def clean_up_if_necessary
end

def self.for(file_path)
LOADED.loaded?(file_path) ? LOADED[file_path] : LOADED[file_path] = new(file_path)
end
end
end
25 changes: 25 additions & 0 deletions lib/rails_development_boost/routes_loaded_file.rb
@@ -0,0 +1,25 @@
module RailsDevelopmentBoost
class RoutesLoadedFile < LoadedFile
def decorator_like?
false
end

def changed?
false
end

def schedule_consts_for_unloading!
Reloader.routes_reloader.force_execute!
end

def add_constants(new_constants)
end

def clean_up_if_necessary
end

def self.for(file_path)
LOADED.loaded?(file_path) ? LOADED[file_path] : LOADED[file_path] = new(file_path)
end
end
end

0 comments on commit 10b426d

Please sign in to comment.