routes

Is there default catch all route to new actions in Play 2?

吃可爱长大的小学妹 提交于 2019-12-05 02:04:41
In Play 1, new actions you defined had a default route. * /{controller}/{action} {controller}.{action} (This appeared by default in new projects) What is the Play 2/2.1 equivalent? Why doesn't it appear in the default routes file? biesior Actually there is a catch-all route available. According to the routing doc in Play 2.0+ you can use Dynamic parts spanning several / so if you put it as exactly last route of given method it will catch every route that wasn't catch before. You can use this for further processing for an example if you have other 'routes' stored in DataBase. GET /*path

Rails 3.1 force .html instead of no extension

大憨熊 提交于 2019-12-05 01:51:19
问题 One of my clients wants his new Rails application to look more like his traditional web site. He wants to know if I can force urls to have a file extension, preferably .html . I don't want to hard-code the extension in routes.rb as match ':controller/:action/:id.html' (or similar) because the client also wants to have a respond_to -style JSON API which requires the use of .:format . Can this be done? 回答1: Just as Mattias Wadman suggested, in config/application.rb add: AppName::Application

Should I use RouteParameter or UrlParameter for an Asp.NET web-api route?

烈酒焚心 提交于 2019-12-05 00:44:38
I've seen both being used and so I wonder, do they do the same thing or different things? If it's the latter, what's the difference? I tried answering it myself by having a look at the visual studio MVC 4 (rc) web api template, but sadly it uses both, so my confusion remains. Here's what the template contains: public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); routes.MapRoute(

Why use match rather than get when routing in Rails?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 00:31:56
In the Ruby on Rails 3 tutorial, the code uses: match '/signup', :to => 'users#new' match '/signin', :to => 'sessions#new' match '/signout', :to => 'sessions#destroy' match '/contact', :to => 'pages#contact' match '/about', :to => 'pages#about' match '/help', :to => 'pages#help' rather than get '/signup', :to => 'users#new' get '/signin', :to => 'sessions#new' get '/signout', :to => 'sessions#destroy' get '/contact', :to => 'pages#contact' get '/about', :to => 'pages#about' get '/help', :to => 'pages#help' even though all the routes only want the HTTP GET verb. Why not use get (or :via => [

Full working example of react-native-side-menu with routes or navigation [closed]

南楼画角 提交于 2019-12-05 00:25:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I found few posts that give some "hints" on how to integrate navigation\routes with react-native-side-menu, unfortunately didn't find any post that show full working example of such functionality. I'm also not sure what is the simplest implementation for navigation\routes, and what's the difference between these

AngularJS catch-all route?

你离开我真会死。 提交于 2019-12-04 23:32:36
问题 I'm working on a file editing application in AngularJS. My urls look like this: #/fileName.md or #/folder/fileName.md or #/folder/nested-folder/another-folder/itgoesonforever/filename.MD I don't want to have to do a route for every single depth and it could be ~15 routes deep. Are there any ways to have conditional routes? Crudely: /:fileorfolder?/:fileorfolder?/:fileorfolder?/:fileorfolder? 回答1: I think the best you can do with Angular is * , which is new as of v1.1.5 of $routeProvider: path

How do I do a redirection in routes.rb passing on the query string

五迷三道 提交于 2019-12-04 23:32:12
I had a functioning redirect in my routes.rb like so; match "/invoices" => redirect("/dashboard") I now want to add a query string to this so that, e.g., /invoices?show=overdue will be redirected to /dashboard?show=overdue I've tried several things. The closest I have got is; match "/invoices?:string" => redirect("/dashboard?%{string}") which gives me the correct output but with the original URL still displayed in the browser. I'm sure I'm missing something pretty simple, but I can't see what. You can use request object in this case: match "/invoices" => redirect{ |p, request| "/dashboard?#

Rails 4 - Bootstrap modal form - setup

爱⌒轻易说出口 提交于 2019-12-04 23:16:29
I'm trying to follow this tutorial to setup a modal containing a nested form in my Rails 4 app. I have models for Project and Invite. The associations are: Project has_many :invites Invite belongs_to :project In my views projects folder, I have made a partial called new_invitation.html.erb <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> **here comes whatever you want to show!** </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria

How do you route [OPTIONS] in Rails?

血红的双手。 提交于 2019-12-04 23:07:14
I am making a REST service in Rails. Here are my routes. resources :users match '/users', :controller => 'users', :action => 'options', :constraints => {:method => 'OPTIONS'} I am able to [GET] my users. I am trying to update my users and I get an error: ActionController::RoutingError (No route matches [OPTIONS] "/users/1"): When I run rake routes here are the routes that I am given: users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format) users#new edit_user GET /users/:id/edit(.:format) users#edit user GET /users/:id(.:format) users#show PUT

How to compare two routes using google direction apis or some other apis for iPhone app

馋奶兔 提交于 2019-12-04 22:33:49
问题 I want to compare two routes to check if they are same or not in my iPhone app. There is a person X who wants to go to point A to point B and another person wants to go to point A1 to point B1. I can get a route between A to B using this direction APIs of google. http://maps.googleapis.com/maps/api/directions/xml?origin=Point a A address&destination=Point B address&sensor=false same way I can get route of A1 to B1. but the latitude and longitude I am getting in xmls are not matching (even a