Questions tagged [routes]

Questions about mapping URLs to Controllers and Actions.

MVC web application (like Ruby on Rails, ASP.NET MVC, etc) uses routes to map an arbitrary URL to a specific controller/action.

For example

http://example.com/foo/bar/23

Might pass an id 23 to controller foo, action bar.

Unusual URLs could also be mapped

Given controller places and intended action list, we can use routes to allow this URL:

http://example.com/my/places
32975 questions
46
votes
3 answers

Rails 3 returning a HTTP 406 Not Acceptable?

I have the following controller code: def create @admin = Admin.new(params[:admin]) respond_to do |format| if @admin.save redirect_to(@admin, :notice => 'Admin was successfully created.') else render :action =>…
Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
46
votes
7 answers

How to define route group name in laravel

Is there any way to define the name of route group in laravel? What I'm trying to accomplish by this is to know that the current request belongs to which group so I can make active the main menu and sub menu by the current route…
user6067756
46
votes
13 answers

Laravel previous and next records

I am trying to create a page where I can see all the people in my database and create edits on them. I made a form where I fill in the data from the database of certain fields. I would like to navigate trough them by a Next and Previous button.…
Duikboot
  • 1,093
  • 1
  • 12
  • 24
46
votes
2 answers

Same Rails 4 routes for GET and POST requests

In Rails 3 Match used to point to an action for both "GET" and "POST" and other type of requests. match "user/account" => user#account Now this will point to account action of user's controller for both GET and POST requests. As in Rails 4 "match"…
Adnan Ali
  • 2,890
  • 5
  • 29
  • 50
45
votes
3 answers

Understanding Routing table entry

I want to ask a question about route command in Linux. I have enter following command in Linux terminal > route and got the output: Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * …
mainajaved
  • 7,905
  • 10
  • 36
  • 44
45
votes
7 answers

How do I write a Rails 3.1 engine controller test in rspec?

I have written a Rails 3.1 engine with the namespace Posts. Hence, my controllers are found in app/controllers/posts/, my models in app/models/posts, etc. I can test the models just fine. The spec for one model looks like... module Posts describe…
Martin Streicher
  • 1,983
  • 1
  • 18
  • 18
45
votes
2 answers

Angular paramMap vs queryParamMap?

What are the different paramMap and queryParamMap? Angular website says paramMap - An Observable that contains a map of the required and optional parameters specific to the route. The map supports retrieving single and multiple values from the…
Su Park
  • 463
  • 1
  • 4
  • 6
45
votes
2 answers

Accessing $route.params in VueJS

Looking through this documentation: https://router.vuejs.org/en/essentials/navigation.html It looks like you can bind the Link Text Which is pretty nifty; however, I've had some trouble trying to access…
user8310317
45
votes
2 answers

How to load child route by default in angular 2

At the start of application i want to load child route. Right now URLcome but respective component not load on that section but when again hit the actual URL it comes. like route configure is const appRoutes: Routes = [ { path: 'a',…
Rituraj ratan
  • 10,260
  • 8
  • 34
  • 55
45
votes
8 answers

How to get a list of all routes in ASP.NET Core?

In ASP.NET Core, is there a way to see a list of all the routes defined in Startup? We are using the MapRoute extension method of IRouteBuilder to define the routes. We are migrating an older project WebAPI project. There we could use…
clhereistian
  • 1,261
  • 1
  • 11
  • 19
45
votes
1 answer

What does "proto kernel" means in Unix Routing Table?

I've been searching this in linux-ip.net and the whole internet but does appears nothing. What does the "proto kernel" part means in a Routing Table? Just an example: [root@tristan]# ip route show table local local 192.168.99.35 dev eth0 proto…
Alejandro Sanz Díaz
  • 7,842
  • 4
  • 17
  • 23
44
votes
4 answers

rails singular resource still plural?

I have a search route which I would like to make singular but when I specify a singular route it still makes plural controller routes, is this how it's supposed to be? resource :search Gives me search POST /search(.:format) …
holden
  • 13,471
  • 22
  • 98
  • 160
44
votes
6 answers

Devise Custom Routes and Login Pages

I'm trying to get Custom Routes working in my Rails application (Ruby 1.9.2 with Rails 3). This is my config/routes.rb file match '/dashboard' => 'home#dashboard', :as => 'user_root' devise_for :user do get "/login", :to => "devise/sessions#new"…
Karthik Kastury
  • 587
  • 1
  • 5
  • 11
44
votes
5 answers

Changing the id parameter in Rails routing

Using Ruby on Rails 3's new routing system, is it possible to change the default :id parameter resources :users, :key => :username come out with the following routes /users/new /users/:username /users/:username/edit ...etc I'm asking because…
joeellis
  • 2,745
  • 7
  • 28
  • 45
44
votes
4 answers

Redirect root url to somewhere else in Rails application

I have routes like this: map.namespace 'prepayments', :path_prefix => '/:locale/prepayments' do |prepayment| prepayment.root :controller => 'login', :namespace => 'prepayments' ... end map.redirect '/', :controller => 'prepayments/login' #…
klew
  • 14,837
  • 7
  • 47
  • 59