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:
968 969 970 |
# File 'lib/action_controller/routing.rb', line 968 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
990 991 992 993 |
# File 'lib/action_controller/routing.rb', line 990 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.
974 975 976 |
# File 'lib/action_controller/routing.rb', line 974 def connect(path, = {}) @set.add_route(path, ) end |
#named_route(name, path, options = {}) ⇒ Object
978 979 980 |
# File 'lib/action_controller/routing.rb', line 978 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.
984 985 986 987 |
# File 'lib/action_controller/routing.rb', line 984 def root(*args, &proc) super unless args.length >= 1 && proc.nil? @set.add_named_route("root", *args) end |