Permalink
Browse files

Merge pull request #4470 from ndbroadbent/small_refactoring

Refactored watchable_args and build_original_fullpath methods in Rails::Application
  • Loading branch information...
2 parents 3d25fa0 + 516f102 commit 09c4f0afae5bd1b052b9f12e001decd2adbec224 @josevalim josevalim committed Jan 15, 2012
Showing with 2 additions and 13 deletions.
  1. +2 −13 railties/lib/rails/application.rb
@@ -114,11 +114,8 @@ def routes_reloader #:nodoc:
# Returns an array of file paths appended with a hash of directories-extensions
# suitable for ActiveSupport::FileUpdateChecker API.
def watchable_args
- files = []
- files.concat config.watchable_files
+ files, dirs = config.watchable_files.dup, config.watchable_dirs.dup
- dirs = {}
- dirs.merge! config.watchable_dirs
ActiveSupport::Dependencies.autoload_paths.each do |path|
dirs[path.to_s] = [:rb]
end
@@ -293,15 +290,7 @@ def initialize_console #:nodoc:
end
def build_original_fullpath(env)
- path_info = env["PATH_INFO"]
- query_string = env["QUERY_STRING"]
- script_name = env["SCRIPT_NAME"]
-
- if query_string.present?
- "#{script_name}#{path_info}?#{query_string}"
- else
- "#{script_name}#{path_info}"
- end
+ ["#{env["SCRIPT_NAME"]}#{env["PATH_INFO"]}", env["QUERY_STRING"]].reject(&:blank?).join("?")
end
end
end

0 comments on commit 09c4f0a

Please sign in to comment.