Skip to content

Commit 06710da

Browse files
committed
Fix undefined method .path on nil
Hi, I got a undefined method call on .nil at line 106 of spring/application.rb. After deeper investigation I've found out that my Gemfile didn't have sinatra, but other gem required it. That caused spring to fail loading of rails app and crash. This simple change checks that Rails.application is there before accessing it. With this change it raises proper message that required file is not there.
1 parent 47f9abc commit 06710da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/spring/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def preload
102102
watcher.add loaded_application_features
103103
watcher.add Spring.gemfile, "#{Spring.gemfile}.lock"
104104

105-
if defined?(Rails)
105+
if defined?(Rails) and Rails.application
106106
watcher.add Rails.application.paths["config/initializers"]
107107
watcher.add Rails.application.paths["config/database"]
108108
end

0 commit comments

Comments
 (0)