Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created March 15, 2011 23:03
Show Gist options
  • Save tenderlove/871699 to your computer and use it in GitHub Desktop.
Save tenderlove/871699 to your computer and use it in GitHub Desktop.
Routing Quiz

Rails Quiz

Leave your answer in the comments!

Given this routes file:

Omg::Application.routes.draw do
  match ':controller(/:action(/:id(.:format)))'
end

And these controllers:

module Admin
  class UserController < ActionController::Base
    def show
    end
  end
end

class AdminController < ActionController::Base
  def show
  end
end

class Products < ActionController::Base
  def show
  end
end

What controller do these urls route to?

/products/show/10

/products/show

/admin/user/show/10

/admin/user/show
@oriolgual
Copy link

Thanks for the explanation @pixeltrix!

@joseph-ravenwolfe
Copy link

Shouldn't it be ProductsController < ActionController::Base instead of Products?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment