routes

ASP.NET MVC 2 RC 2 returns Area-specific controller when no area specified

两盒软妹~` 提交于 2019-12-22 07:36:07
问题 I have a basic MVC 2 (RC2) site with one base-level controller ("Home"), and one area ("Admin") with one controller ("Abstract"). When i call http://website/Abstract - the Abstract controller in the Admin area gets called even though i haven't specified the Area in the URL. To make matters worse - it doesn't seem to know it's under Admin because it can't find the associated view and just returns: The view 'Index' or its master was not found. The following locations were searched: ~/Views

Override single route in Symfony2

…衆ロ難τιáo~ 提交于 2019-12-22 06:39:21
问题 How can I override a single route in Symfony2? I have a bundle that comes with a bundle_routing.yml file. In a bundle that extends this parent bundle i also have routing file: routing.xml Note that the files are named different. In this routing file I like to override a single parent route. I tried to simple redeclare it and change the pattern. But it's not applied. parent: MyParentBundle_detailpage: pattern: /detail defaults: { _controller: "MyParentBundle:Item:detail" } child: <route id=

Is the controller name derived from the class name?

我们两清 提交于 2019-12-22 06:36:34
问题 This is a newbie question... I am looking at the default asp.net mvc3 project and noticed that there is a controller called: public class AccountController : Controller I looked throughout the code and couldn't find a place that specified AccountController maps to /Account/ for the URL. I discovered that you can change the routing using routes.MapRoute(..) in the Global.asax , but I still don't know where they specified that AccountController maps to /Account/. If it is assumed from the class

Angular - Navigate to current same URL with component reload not the whole page

匆匆过客 提交于 2019-12-22 05:54:54
问题 I am using Angular 5 library, I want to navigate to current URL with reload (refresh) the whole component not the page, I have read about navigation to current URL in angular document. And that it is what I need: /** * Define what the router should do if it receives a navigation request to the current URL. * By default, the router will ignore this navigation. However, this prevents features such * as a "refresh" button. Use this option to configure the behavior when navigating to the *

Laravel 5.5 Model binding in routes doesn't work

青春壹個敷衍的年華 提交于 2019-12-22 04:55:21
问题 In my routes.php I have this: Route::get('user/{user}/permissions/','UserController@permissions')->name('user.permissions'); In my controller I have: public function permissions(User $user){ dd($user); } $user is empty object (like new user; without attributes ) if I use: public function permissions($user){ dd(User::find($user)); } Works perfectly!! I have previously Laravel 5.2 and this code works fine but in Laravel 5.5 it doesn't work, any ideas why? 回答1: Sounds like you upgraded from 5.2

Backbone.js Router Matching Optional Parameters

我是研究僧i 提交于 2019-12-22 04:49:09
问题 I'm trying to create a backbone router that can match optional parameters. Consider the following code: routes: { '/jobs' : 'jobs', '/jobs/p:page' : 'jobs', '/jobs/job/:job_id' : 'jobs', '/jobs/p:page/job/:job_id' : 'jobs' } jobs: function(page, job_id){ // do stuff here .... } If I navigate to URL abc.com/ #/jobs/p104/ the page parameter will be 104 . However, if navigate to abc.com/ #/jobs/job/93 , the job_id parameter is undefined but the page parameter is 93 . So Backbone's router

How to change will_paginate URLs?

早过忘川 提交于 2019-12-22 04:37:28
问题 I'm trying to change the will_paginate links from the format of /list?page=1 to /list/page/1 . I have the routes setup right for this, but will_paginate is using the query string in links rather than my pretty URL style. How to tell it otherwise? I'm using will_paginate 2.3.16 and Rails 2.3.14 . 回答1: will_paginate uses the url_for helper. If you define routes containing the parameters it uses, it should generate pretty urls. map.connect '/lists/page/:page', :controller => 'lists', :action =>

Creating a route with Sinatra to only accept a certain Content-type

我的梦境 提交于 2019-12-22 04:37:21
问题 I'm trying to create a route with Sinatra that only accepts POST with an Content-type: application/json without success. My approach is as follows: post '/dogs', :provides => :json do # returns here a json response end Testing with curl, I have seen that :provides => :json configures the route to respond with an Content-Type: application/json . That's right because I want also to respond with a JSON message to the POST request but I really need that this route only respond to POST requests

Restricting resource routes and adding additional non-RESTful routes in Rails 3

丶灬走出姿态 提交于 2019-12-22 04:03:33
问题 I wasn't able to find anything here or elsewhere that covered both restricting a resource's routes and adding additional non-RESTful routes in Rails 3. It's probably very simple but every example or explanation I've come across addresses just one case not both at the same time. Here's an example of what I've been doing in Rails 2: map.resources :sessions, :only => [:new, :create, :destroy], :member => {:recovery => :get} Pretty straightforward, we only want 3 of the 7 RESTful routes because

Ruby on Rails: Use slug instead of id on resource routes

做~自己de王妃 提交于 2019-12-22 03:58:34
问题 So I'm looking for a solution that would help me achieve the following with Rails resource: /admin/articles/:slug/edit as opposed to /admin/articles/:id/edit I'm looking for Rails resource routes and not the other kinds of routes. Just wanted to know if it was possible. If so, how? 回答1: # config/routes.rb resources :articles, param: :slug In the terminal: $ rake routes ... article GET /articles/:slug(.:format) articles#show ... 回答2: The :id parameter in the routing is simply a placeholder and