Class: ActionController::Routing::RouteSet::Mapper
- Defined in:
- lib/action_controller/routing.rb
Overview
Mapper instances are used to build routes. The object passed to the draw block in config/routes.rb is a Mapper instance.
Mapper instances have relatively few instance methods, in order to avoid clashes with named routes.
Instance Method Summary collapse
-
#connect(path, options = {}) ⇒ Object
Create an unnamed route with the provided
path
andoptions
. -
#initialize(set) ⇒ Mapper
constructor
:nodoc:.
- #method_missing(route_name, *args, &proc) ⇒ Object
- #named_route(name, path, options = {}) ⇒ Object
-
#root(*args, &proc) ⇒ Object
Added deprecation notice for anyone who already added a named route called “root”.
Constructor Details
#initialize(set) ⇒ Mapper
:nodoc:
979 980 981 |
# File 'lib/action_controller/routing.rb', line 979 def initialize(set) @set = set end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(route_name, *args, &proc) ⇒ Object
1001 1002 1003 1004 |
# File 'lib/action_controller/routing.rb', line 1001 def method_missing(route_name, *args, &proc) super unless args.length >= 1 && proc.nil? @set.add_named_route(route_name, *args) end |
Instance Method Details
#connect(path, options = {}) ⇒ Object
Create an unnamed route with the provided path
and options
. See SomeHelpfulUrl for an introduction to routes.
985 986 987 |
# File 'lib/action_controller/routing.rb', line 985 def connect(path, = {}) @set.add_route(path, ) end |
#named_route(name, path, options = {}) ⇒ Object
989 990 991 |
# File 'lib/action_controller/routing.rb', line 989 def named_route(name, path, = {}) @set.add_named_route(name, path, ) end |
#root(*args, &proc) ⇒ Object
Added deprecation notice for anyone who already added a named route called “root”. It’ll be used as a shortcut for map.connect ” in Rails 2.0.
995 996 997 998 |
# File 'lib/action_controller/routing.rb', line 995 def root(*args, &proc) super unless args.length >= 1 && proc.nil? @set.add_named_route("root", *args) end |