Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2010 10:31
Show Gist options
  • Save wincent/462489 to your computer and use it in GitHub Desktop.
Save wincent/462489 to your computer and use it in GitHub Desktop.
From ac95f82382939821dc89c5fef9f9c5404f528768 Mon Sep 17 00:00:00 2001
From: Wincent Colaiuta <>
Date: Sat, 3 Jul 2010 12:12:50 +0200
Subject: [PATCH] Fixes for "router" and "routes" terminology
Commit f7ba614c2db improved the internal consistency of the different
means of accessing routes, but it introduced some problems at the level
of code comments and user-visible strings.
This commit applies fixes on three levels:
Firstly, we remove or replace grammatically invalid constructs such as
"a routes" or "a particular routes".
Secondly, we make sure that we always use "the router DSL" or "the
router syntax", because this has always been the official terminology.
Finally, we make sure that we only use "routes" when referring to the
application-specific set of routes that are defined in the
"config/routes.rb" file, we use "router" when referring on a more
abstract level to "the code in Rails used to handle routing", and we use
"routing" when we need an adjective to apply to nouns such as
"url_helpers. Again this is consistent with historical practice and
other places in the documentation.
Note that this is not a sweep over the entire codebase to ensure
consistent usage of language; it is just a revision of the changes
introduced in commit f7ba614c2db.
Signed-off-by: Wincent Colaiuta <>
actionmailer/lib/action_mailer/base.rb | 4 ++--
.../lib/action_controller/deprecated/base.rb | 2 +-
actionpack/lib/action_controller/metal.rb | 2 +-
actionpack/lib/action_controller/metal/url_for.rb | 4 ++--
.../action_dispatch/routing/deprecated_mapper.rb | 2 +-
actionpack/lib/action_dispatch/routing/mapper.rb | 2 +-
.../lib/action_dispatch/routing/route_set.rb | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 8b86d83..ed4bea0 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -737,13 +737,13 @@ module ActionMailer #:nodoc:
raise "You can no longer call ActionMailer::Base.default_url_options " \
"directly. You need to set config.action_mailer.default_url_options. " \
"If you are using ActionMailer standalone, you need to include the " \
- "url_helpers of a routes directly."
+ "routing url_helpers directly."
# This module will complain if the user tries to set default_url_options
# directly instead of through the config object. In Action Mailer's Railtie,
- # we include the url_helpers of the routes, which will override this module
+ # we include the router's url_helpers, which will override this module.
extend DeprecatedUrlOptions
ActiveSupport.run_load_hooks(:action_mailer, self)
diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb
index 16b67b8..3975afc 100644
--- a/actionpack/lib/action_controller/deprecated/base.rb
+++ b/actionpack/lib/action_controller/deprecated/base.rb
@@ -96,7 +96,7 @@ module ActionController
def resource_action_separator=(val)
ActiveSupport::Deprecation.warn "ActionController::Base.resource_action_separator is deprecated and only " \
- "works with the deprecated routes DSL."
+ "works with the deprecated router DSL."
@resource_action_separator = val
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 8166d31..2281c50 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -47,7 +47,7 @@ module ActionController
# In AbstractController, dispatching is triggered directly by calling #process on a new controller.
# ActionController::Metal provides an #action method that returns a valid Rack application for a
- # given action. Other rack builders, such as Rack::Builder, Rack::URLMap, and the Rails routes,
+ # given action. Other rack builders, such as Rack::Builder, Rack::URLMap, and the Rails router,
# can dispatch directly to the action returned by FooController.action(:index).
class Metal < AbstractController::Base
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb
index 0c1e2fb..a51fc5b 100644
--- a/actionpack/lib/action_controller/metal/url_for.rb
+++ b/actionpack/lib/action_controller/metal/url_for.rb
@@ -13,8 +13,8 @@ module ActionController
def _routes
- raise "In order to use #url_for, you must include the helpers of a particular " \
- "routes. For instance, `include Rails.application.routes.url_helpers"
+ raise "In order to use #url_for, you must include routing helpers explicitly. " \
+ "For instance, `include Rails.application.routes.url_helpers"
module ClassMethods
diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
index 9684b86..e122bdf 100644
--- a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
@@ -30,7 +30,7 @@ module ActionDispatch
class DeprecatedMapper #:nodoc:
def initialize(set) #:nodoc:
- ActiveSupport::Deprecation.warn "You are using the old routes DSL which will be removed in Rails 3.1. " <<
+ ActiveSupport::Deprecation.warn "You are using the old router DSL which will be removed in Rails 3.1. " <<
"Please check how to update your routes file at:"
@set = set
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index d71005a..64e12f9 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -308,7 +308,7 @@ module ActionDispatch
if name_prefix = options.delete(:name_prefix)
options[:as] ||= name_prefix
- ActiveSupport::Deprecation.warn ":name_prefix was deprecated in the new routes syntax. Use :as instead.", caller
+ ActiveSupport::Deprecation.warn ":name_prefix was deprecated in the new router syntax. Use :as instead.", caller
case args.first
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 177a6db..24f9981 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -480,7 +480,7 @@ module ActionDispatch
path_options = yield(path_options) if block_given?
path = generate(path_options, path_segments || {})
- # ROUTES TODO: This can be called directly, so script_name should probably be set in routes
+ # ROUTES TODO: This can be called directly, so script_name should probably be set in the routes
rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
rewritten_url << "##{Rack::Mount::Utils.escape_uri(options[:anchor].to_param.to_s)}" if options[:anchor]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment