routing

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 although the above example is simple, it would be really helpful to do in a current projec...

How Does One Differentiate Between Routes POSTed To In Asp.Net MVC?

I have two actions, one that accepts a ViewModel and one that accepts two parameters a string and an int, when I try to post to the action, it gives me an error telling me that the current request is ambiguous between the two actions. Is it possible to indicate to the routing system which action is the relevant one, and if it is how is ...

Reference another route in your routing.yml in Symfony ?

Developping a plugin, I have a routing.yml in my plugin dir, specifying a route with sfPropelRoute. in my plugins/myPlugin/config/routing.yml : myplugin_test: url: /myurl/:id class: sfPropelRoute options: { model: myClass, type: object, method_for_criteria: selectAvailableObj } params: { module: mymodule, action: show } r...

How do I specify an action on a resource in a namespace in rails 3?

I have a resource :products in a namespace :shop, like this: namespace :shop do resources :products root :to => 'products#index' end When running rake routes it outputs the following: edit_shop_product GET /shop/products/:id/edit(.:format) {:action=>"edit", :controller=>"shop/products"} But when I use the edit_shop_product_p...

Rails route rewriting quesiton

Hi guys, I think this is an easy question. I am using this useful Flash Document Reader called FlexPaper. I have it embeded in one of my Show pages. But when I click the a link on their tool bar to show the document in a new browser, it points to the following link ... http://0.0.0.0:3000/intels/FlexPaperViewer.swf?ZoomTime=0.5&a...

Web Forms Routing not having correct path to images, css, scripts ...

Hello, I am trying to use new .net 4.0 Routing for Web Forms with mixed success. protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } public static void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute( "", "article/{id}/{title...

Form submission and hyperlinks using GET and POST

I have a search resource, the user can perform searches by filling out a form and submitting it, the create action is called, the Search is saved, the show action is called, and the results are displayed. This all happens with the default POST, and all works fine. The user may want to save his search in the saved_search table (i don't u...

How to map non-REST URLS to REST ones?

I have a small rails app that has default scaffold generated routes eg. /stadia/1.xml. However I have to support legacy client app that can't construct such URLs correctly. What I need to do is to map URL in the form: /stadia?id=1?format=xml to /stadia/1.xml Or even something like: /myApp?model=<model_name>?id=<id>?format=xml to /<mod...

ASp.NEt MVC: how to parse url string to get RouteData

Hi. Is there any way hot to get RouteData from url string? I have login form with returlUrl as query string parameter. My routes are defined as : {languageCode}/{controller}/{action} In action method LogIn(string returlUrl) the returlUrl is something like "en/home/contacts" etc. I need to change languagePart a i dont want to use strin...

Non-standard routes in Rails

I currently have a routes.rb file that looks like this: map.resources :profiles do |profile| profile.resources :projects, :has_many => :tasks end And this gives me routes like this: /profiles/:profile_id/projects/:project_id/tasks This is close to what I want, but instead of the '/profiles/:profile_id/' section I want to just hav...

ASP.NET MVC 2: Application areas and routes

So my application is growing and I'd like to split out my View-based controllers from my JSON-based controllers. Basically, I have a bunch of controllers that all they do is return JSON results for AJAX calls. What I would like to do would be to set up the routes (and the folder structure under my Controllers folder, for that matter) su...

Account for simple url rewriting in ASP.NET MVC redirect

How would you go about redirecting in ASP.NET MVC to take into account some external URL rewriting rules. For example: What the user enters: http://www.example.com/app/route What ASP.NET MVC sees: /route What I want to redirect to: http://www.example.com/app/other_route What actually happens when I do a simple RedirectToAction: http:/...

MVC: Upload image in partial view, routing problem

I am trying to upload images via a form which sits in partial view using MVC. View Code: <form action="/Item/ImageUpload" method="post" enctype="multipart/form-data"> <%= Html.TextBox("ItemId",Model.ItemId) %> <input type="file" name="file" id="file" /> <input type="submit" value="Add" /> </form> Action Code: public void I...

URI routing in codeigniter

I have my CI site working well except the URL's are a bit ugly. What approach should I take to enable me to route what is displaying at: http://domain.com/content/index/6/Planning to the url: http://domain.com/Planning I'm confused about whether this should be be done in the routes file or in my .htaccess Thanks ...

Custom Google Route that avoids certain points

I'm writting a web app in php that gets custom routes. Using the Google Maps API I am able to get the route from point A to point B. Now, I would like to avoid a certain point that appears along the found route. Is that possible? Does Google Maps allow this operation or do I have to compute it by hand? If so, have you got any idea where...

Rails Routing INSIDE CSS

Is there any way I can route assets inside of my css to where the rest of the views are pulling them? I mean, inside the CSS can I call url_for or css_for or something like that in order to have the images go through the assets router? Thank you in advance! ...

Clearly defined Rails routing problem - undefined method for Nil:NilClass

Guys and girls, I have been working on this problem for a while but still no joy. This is my second question within this general area, because the last question was getting too long and this is now more well-defined. Summary of the Problem: I am loading a page for my customers and I get error: undefined method 'name' for Nil:NilClass...

Toll Charges for Google Maps?

I'm writing an application that will calculate the distance and cost between two points. One of the requirements is that I need to calculate the cost of the journey (gas and road tolls). Gas is easy. However, I can't think of a good way of doing toll charges. Google tells me if the GStep has a toll but it doesn't say how much. It seems l...

How to route tree-structured URLs with ASP.NET Routing?

Hello Everyone, I would like to achieve something very similar to this question, with some enhancements. There is an ASP.NET MVC web application. I have a tree of entities. For example, a Page class which has a property called Children, which is of type IList<Page>. (An instance of the Page class corresponds to a row in a database.) ...

Rails routes question. Always find by name and remove /class_name/ from route

I have a Category model and a Product model. Category has_many products and Product belongs_to Category I want my routes to be like this: /:category_type/:category_name/ opens Product#index /:category_type/ opens Category#index / opens Category#index Is there a way to achieve that with resources? I tried with path_prefix but...