routes

translate rails namespaces

Hi, lets say i have the following resource map.namespace :admin do |a| a.resources :users end to access the users index action I would have to type /admin/users How can I translate this route to different languages? map.namespace :admin do |a| a.resources :users, :as => ipsum end would result in /admin/ipsum How can i c...

ASP.NET MVC2 lowercase Routes in Visual Basic

I have found 4 or 5 examples of "lowercase routes" in C# however when I use the telerik code converter, I get a bunch of errors. Namely something to do with "extension methods can be defined only in modules." Does anyone have any good resources on how to map routes to lowercase in VB? EDIT: here is an example of some converted code t...

Getting shortest route(distance) in google maps api

I want to get the road distance between severel points(distance from one node to each other) in google maps api and pass those to asp.net code and then calculate the shortest route using an algorithm and then again pass the seqence of the nodes(optimised) to google maps and draw the path. If you guys can help me its great!!! ...

Routing HTTP verbs in Rails

I'm trying to route only an http verb. Say I have a comments resource like so: map.resources :comments And would like to be able to destroy all comments by sending a DELETE /comments request. I.e. I want to be able to map just the http verb without the "action name" part of the route. Is this possible? Cheers ...

ASP.NET MVC Routing - Pass inbound route value to outbound URLs automatically?

I have an ASP.NET MVC application with an Admin area that deals with administering Companies and their child entities, such as Users and Products. The default route associated with a child entity is defined as follows: "Admin/Company/{companyID}/{controller}/{id}/{action}" I would like to ensure that, everywhere in the Admin area, whe...

Silverlight ASP.MVC routes

Hi, how can I emulate stuff like <%=Url.Action("Action","Controller" ... where I am using Silverlight 4 as the client to ASP.MVC in say OpenReadAsync? Aside from passing it a Uri with the full path as a string - not preferred. Cheers ...

Cost of too much database access.

Hi! I'm wondering if my idea is possible*. I'm doing a project on road networks and I plan to do many database access; meaning, for example, to check if one route is connected to another route, check database if connection exist? I have predefined information about the routes so I want to use them as mush as possible, but I'm worried tha...

Rails controller/routing question

I am new to RoR and I cant get one of my rotes to work, not sure whats going on? I have defined a route in my routes.rb file, somthing like this... map.connect 'myurl/:someid/:start/:limit', :conditions => { :method => :get }, :controller => 'mycontroller', :action => 'get_data_list' # method defintion in mycontroller def get_data_lis...

How to use SEO urls in CakePHP without the ID?

Hello, Is there a simple way to route my URLs without showing the ID in the URL. For example i have: www.mywebsite.com/id-article-title.html and i want only www.mywebsite.com/article-title.html Regards ...

How to handle 404's with Regex-based routing?

Please consider the following very rudimentary "controllers" (functions in this case, for simplicity): function Index() { var_dump(__FUNCTION__); // show the "Index" page } function Send($n) { var_dump(__FUNCTION__, func_get_args()); // placeholder controller } function Receive($n) { var_dump(__FUNCTION__, func_get_args())...

Routing by hostname in CakePHP

Is it possible to do domain-specific routes in cakephp? for example, let's say I have 2 domains: manufacturer.com and productname.com productname.com is parked on manufacturer.com. I'd like to create a route like this: Router::connect('http://www.productname.com/', array('controller' => 'products', 'action' => 'view', 'productSlug'))...

RSpec: testing path to route mapping (but not the other way around)

Hello, I need to use the functionality of params_from, which was deprecated. Now route_to combines behavior of params_from and route_for. But I do not want to test that the route generates the path, because it does not and this is intentional (for backward compatability in old emails, I need to "alias" old path to the correct controller...

How do you structure a restful route with several GET constraints?

Suppose you are working on an API, and you want nice URLs. For example, you want to provide the ability to query articles based on author, perhaps with sorting. Standard: GET http://example.com/articles.php?author=5&amp;sort=desc I imagine a RESTful way of doing this might be: GET http://example.com/aritcles/all/author/5/sort/desc ...

Legacy URLs in CakePHP using routes or htaccess

I'm in the midst of moving a site from "plain old" php to the CakePHP framework and I need to be able to handle some legacy URLs, for example: foo.com/bar.php?id=21 is the pattern of the current URLs, but in the new site using cake, that URL needs to redirect to: foo.com/blah/21 So basically, I need to be able to grab that ID numbe...

ASP.Net MVC 2 Area, SubArea and Routes

I have been looking around for a solution for my problem. Found alot of similar issues, but none of them led to a solution for me. I am trying to register an Area within an Area. This works however it "partially" screws up my routing. My route registrations in the order they are registered, consider the FooBar and Foo registrations to...

How do I add a route from within a Rails App

Hi I'm writing a spec and i need to setup a test route from inside the spec however when i use Rails::Application.routes.draw it overwrites all the other routes. Is there a way to do this in rails 3? Cheers Dan ...

Getting gateway to use for a given ip in ANSI C

I have looked around like crazy but don't get a real answer. I got one example, but that depended on the individuals own library so not much good. At first I wanted to get the default gateway of an interface, but since different IP's could be routed differently I quickly understood that what I want it get the gateway to use for a given ...

match method in routes.rb

I'm trying to follow this tutorial here but the tutorial seems to use this "match" function. match '/about', :to => 'pages#about' Whenever, I do the same, I get this error from the server: undefined method `match' for main:Object How can I edit the routes.rb file such that: it will route from a long file path to a short one ...

MVC 2 Routes issue (bug?)

Hi all, So, I've run into a weird issue with a route in my application. For some reason it just won't match. It looks like {controller}/Comments/Put and it has corresponding constraints to make sure it gets into the right controller, in this case "Misc". When I post to the route it just doesn't match... I plugged in the RouteDebugger l...

ASP.NET MVC 2.0 Simple Routing Question

Im in the process of moving our website from a crappy CMS over to a nice custom coded MVC website. Everything has gone smoothly so far but I'm having some issues with routing. Our company sends out a lot of marketing emails and letters. In these we have the user go to Landing Pages so we can track how campaigns are doing, as well as o...