Skip to content
This repository
Browse code

Merge pull request #4470 from ndbroadbent/small_refactoring

Refactored watchable_args and build_original_fullpath methods in Rails::Application
  • Loading branch information...
commit 09c4f0afae5bd1b052b9f12e001decd2adbec224 2 parents 3d25fa0 + 516f102
José Valim josevalim authored

Showing 1 changed file with 2 additions and 13 deletions. Show diff stats Hide diff stats

  1. +2 13 railties/lib/rails/application.rb
15 railties/lib/rails/application.rb
@@ -114,11 +114,8 @@ def routes_reloader #:nodoc:
114 114 # Returns an array of file paths appended with a hash of directories-extensions
115 115 # suitable for ActiveSupport::FileUpdateChecker API.
116 116 def watchable_args
117   - files = []
118   - files.concat config.watchable_files
  117 + files, dirs = config.watchable_files.dup, config.watchable_dirs.dup
119 118
120   - dirs = {}
121   - dirs.merge! config.watchable_dirs
122 119 ActiveSupport::Dependencies.autoload_paths.each do |path|
123 120 dirs[path.to_s] = [:rb]
124 121 end
@@ -293,15 +290,7 @@ def initialize_console #:nodoc:
293 290 end
294 291
295 292 def build_original_fullpath(env)
296   - path_info = env["PATH_INFO"]
297   - query_string = env["QUERY_STRING"]
298   - script_name = env["SCRIPT_NAME"]
299   -
300   - if query_string.present?
301   - "#{script_name}#{path_info}?#{query_string}"
302   - else
303   - "#{script_name}#{path_info}"
304   - end
  293 + ["#{env["SCRIPT_NAME"]}#{env["PATH_INFO"]}", env["QUERY_STRING"]].reject(&:blank?).join("?")
305 294 end
306 295 end
307 296 end

0 comments on commit 09c4f0a

Please sign in to comment.
Something went wrong with that request. Please try again.