Skip to content

Instantly share code, notes, and snippets.

@mrpunkin
Created July 15, 2013 22:05
Show Gist options
  • Select an option

  • Save mrpunkin/6003923 to your computer and use it in GitHub Desktop.

Select an option

Save mrpunkin/6003923 to your computer and use it in GitHub Desktop.
Preferred method for named routes in a single, non-resource controller?
## Option A
scope "search", :controller => :search do
root :to => 'search#index', :as => 'search'
get :users, :as => "search_users"
get :photos, :as => "search_photos"
end
## Option B
match "/search" => "search#index", :as => "search"
match "/search/users" => "search#users", :as => "search_users"
match "/search/photos" => "search#photos", :as => "search_photos"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment