Class: Aikido::Zen::Request::RailsRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/aikido/zen/request/rails_router.rb

Overview

The Rails router relies on introspecting the routes defined in the Rails app to match the current request to the correct route, building Route objects that have the exact pattern defined by the developer, rather than a heuristic approximation.

For example, given the following route definitions:

resources :posts do
  resources :comments
end

The router will map a request to “/posts/123/comments/234” to “/posts/:post_id/comments/:id(.:format)”.

See Also:

  • Aikido::Zen::Router::HeuristicRouter

Instance Method Summary collapse

Constructor Details

#initialize(route_set) ⇒ RailsRouter

Returns a new instance of RailsRouter.



23
24
25
# File 'lib/aikido/zen/request/rails_router.rb', line 23

def initialize(route_set)
  @route_set = route_set
end

Instance Method Details

#recognize(request) ⇒ Object



27
28
29
# File 'lib/aikido/zen/request/rails_router.rb', line 27

def recognize(request)
  recognize_in_route_set(request, @route_set)
end